/* Generated by Cython 0.29.12 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/Users/rsingh/software/anaconda/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h",
            "/Users/rsingh/software/anaconda/lib/python3.7/site-packages/numpy/core/include/numpy/ufuncobject.h"
        ],
        "extra_compile_args": [
            "-mmacosx-version-min=10.9"
        ],
        "extra_link_args": [
            "-mmacosx-version-min=10.9"
        ],
        "include_dirs": [
            "/Users/rsingh/software/anaconda/lib/python3.7/site-packages/numpy/core/include"
        ],
        "name": "pyross.inference",
        "sources": [
            "pyross/inference.pyx"
        ]
    },
    "module_name": "pyross.inference"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_12"
#define CYTHON_HEX_VERSION 0x001D0CF0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#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))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
  #define PyObject_Unicode             PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__pyross__inference
#define __PYX_HAVE_API__pyross__inference
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include <math.h>
#include "pythread.h"
#include <stdlib.h>
#include "pystate.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "pyross/inference.pyx",
  "stringsource",
  "__init__.pxd",
  "type.pxd",
  "pyross/deterministic.pxd",
};
/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define __Pyx_MemoryView_Len(m)  (m.shape[0])

/* Atomics.proto */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __pyx_atomic_int_type int
#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
                    !defined(__i386__)
    #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
    #include <Windows.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type LONG
    #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
    #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using Intel atomics"
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()


/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":800
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":808
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":811
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

/* "pyross/deterministic.pxd":5
 * cimport cython
 * 
 * ctypedef np.float_t DTYPE_t             # <<<<<<<<<<<<<<
 * 
 * cdef class CommonMethods:
 */
typedef __pyx_t_5numpy_float_t __pyx_t_6pyross_13deterministic_DTYPE_t;

/* "pyross/inference.pyx":47
 * 
 * DTYPE   = np.float
 * ctypedef np.float_t DTYPE_t             # <<<<<<<<<<<<<<
 * ctypedef np.uint8_t BOOL_t
 * 
 */
typedef __pyx_t_5numpy_float_t __pyx_t_6pyross_9inference_DTYPE_t;

/* "pyross/inference.pyx":48
 * DTYPE   = np.float
 * ctypedef np.float_t DTYPE_t
 * ctypedef np.uint8_t BOOL_t             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
typedef __pyx_t_5numpy_uint8_t __pyx_t_6pyross_9inference_BOOL_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/
struct __pyx_obj_6pyross_13deterministic_CommonMethods;
struct __pyx_obj_6pyross_13deterministic_SIR;
struct __pyx_obj_6pyross_13deterministic_SIRS;
struct __pyx_obj_6pyross_13deterministic_SEIR;
struct __pyx_obj_6pyross_13deterministic_SEI8R;
struct __pyx_obj_6pyross_13deterministic_SIkR;
struct __pyx_obj_6pyross_13deterministic_SEkIkR;
struct __pyx_obj_6pyross_13deterministic_SEkIkIkR;
struct __pyx_obj_6pyross_13deterministic_SEAIR;
struct __pyx_obj_6pyross_13deterministic_SEAI8R;
struct __pyx_obj_6pyross_13deterministic_SEAIRQ;
struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing;
struct __pyx_obj_6pyross_13deterministic_Spp;
struct __pyx_obj_6pyross_13deterministic_SppSparse;
struct __pyx_obj_6pyross_13deterministic_SppQ;
struct __pyx_obj_6pyross_13deterministic_SppQ_old;
struct __pyx_obj_6pyross_13deterministic_SEI5R;
struct __pyx_obj_6pyross_13deterministic_SEAI5R;
struct __pyx_obj_6pyross_9inference_SIR_type;
struct __pyx_obj_6pyross_9inference_SIR;
struct __pyx_obj_6pyross_9inference_SEIR;
struct __pyx_obj_6pyross_9inference_SEAIRQ;
struct __pyx_obj_6pyross_9inference_SEAIRQ_testing;
struct __pyx_obj_6pyross_9inference_Spp;
struct __pyx_obj_6pyross_9inference_SppQ;
struct __pyx_obj_6pyross_9inference_SppQ_old;
struct __pyx_obj_6pyross_9inference_SppSparse;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op;
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj;
struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj;
struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov;
struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space;
struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix;
struct __pyx_opt_args_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix;
struct __pyx_opt_args_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix;
struct __pyx_opt_args_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix;
struct __pyx_opt_args_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix;
struct __pyx_opt_args_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix;
struct __pyx_opt_args_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix;

/* "pyross/inference.pyx":3235
 *         return np.add(x0, v)
 * 
 *     cdef double _obtain_logp_for_traj(self, double [:, :] x, double Tf,             # <<<<<<<<<<<<<<
 *                                      Py_ssize_t inter_steps=0):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj {
  int __pyx_n;
  Py_ssize_t inter_steps;
};

/* "pyross/inference.pyx":3269
 *         return -log_p
 * 
 *     cdef double _obtain_logp_for_lat_traj(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False,
 *                                          Py_ssize_t inter_steps=0):
 */
struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj {
  int __pyx_n;
  PyObject *tangent;
  Py_ssize_t inter_steps;
};

/* "pyross/inference.pyx":3403
 *         return cov
 * 
 *     cpdef obtain_full_mean_cov(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 */
struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov {
  int __pyx_n;
  Py_ssize_t inter_steps;
};

/* "pyross/inference.pyx":3453
 *         return np.asarray(ip).T
 * 
 *     cpdef obtain_full_mean_cov_tangent_space(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 */
struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space {
  int __pyx_n;
  Py_ssize_t inter_steps;
};

/* "pyross/inference.pyx":3579
 * 
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                              b_matrix=True, jacobian=False):
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 */
struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/inference.pyx":3692
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                                 b_matrix=True, jacobian=False):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/inference.pyx":3832
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/inference.pyx":3998
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/inference.pyx":4194
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/inference.pyx":4519
 *         return r
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/inference.pyx":5032
 *         return ntestpop, tau0
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 */
struct __pyx_opt_args_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix {
  int __pyx_n;
  PyObject *b_matrix;
  PyObject *jacobian;
};

/* "pyross/deterministic.pxd":7
 * ctypedef np.float_t DTYPE_t
 * 
 * cdef class CommonMethods:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly int N, M, kI, kE, nClass
 */
struct __pyx_obj_6pyross_13deterministic_CommonMethods {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods *__pyx_vtab;
  int N;
  int M;
  int kI;
  int kE;
  int nClass;
  double gIh;
  double gIc;
  double fh;
  double ep;
  double gI;
  double gIsp;
  double gIcp;
  double gIhp;
  PyArrayObject *rp0;
  PyArrayObject *Ni;
  PyArrayObject *dxdt;
  PyArrayObject *CM;
  PyArrayObject *FM;
  PyArrayObject *population;
  PyArrayObject *sa;
  PyArrayObject *iaa;
  PyArrayObject *hh;
  PyArrayObject *cc;
  PyArrayObject *mm;
  PyArrayObject *alpha;
  PyObject *paramList;
  PyObject *readData;
};


/* "pyross/deterministic.pxd":25
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIR)
 */
struct __pyx_obj_6pyross_13deterministic_SIR {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  PyArrayObject *beta;
  PyArrayObject *gIa;
  PyArrayObject *gIs;
  PyArrayObject *fsa;
};


/* "pyross/deterministic.pxd":45
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIRS(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed, Susceptible (SIRS)
 */
struct __pyx_obj_6pyross_13deterministic_SIRS {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":63
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEIR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Infected, Removed (SEIR)
 */
struct __pyx_obj_6pyross_13deterministic_SEIR {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  PyArrayObject *beta;
  PyArrayObject *gIa;
  PyArrayObject *gIs;
  PyArrayObject *gE;
  PyArrayObject *fsa;
};


/* "pyross/deterministic.pxd":78
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEI8R(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Infected, Removed (SEIR). The infected class has 5 groups.
 */
struct __pyx_obj_6pyross_13deterministic_SEI8R {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":110
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIkR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIkR). Method of k-stages of I
 */
struct __pyx_obj_6pyross_13deterministic_SIkR {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":125
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEkIkR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIkR). Method of k-stages of I
 */
struct __pyx_obj_6pyross_13deterministic_SEkIkR {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":142
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEkIkIkR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIkR). Method of k-stages of I
 */
struct __pyx_obj_6pyross_13deterministic_SEkIkIkR {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":159
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed (SEAIR)
 */
struct __pyx_obj_6pyross_13deterministic_SEAIR {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gA;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":179
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAI8R(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Activates, Infected, Removed (SEAIR). The infected class has 5 groups:
 */
struct __pyx_obj_6pyross_13deterministic_SEAI8R {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gA;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":210
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */
struct __pyx_obj_6pyross_13deterministic_SEAIRQ {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  PyArrayObject *beta;
  PyArrayObject *gE;
  PyArrayObject *gA;
  PyArrayObject *gIs;
  PyArrayObject *gIa;
  PyArrayObject *fsa;
  PyArrayObject *tS;
  PyArrayObject *tE;
  PyArrayObject *tA;
  PyArrayObject *tIa;
  PyArrayObject *tIs;
};


/* "pyross/deterministic.pxd":234
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ_testing(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */
struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  PyArrayObject *beta;
  PyArrayObject *gE;
  PyArrayObject *gA;
  PyArrayObject *gIa;
  PyArrayObject *gIs;
  PyArrayObject *fsa;
  PyArrayObject *ars;
  PyArrayObject *kapE;
  PyObject *testRate;
};


/* "pyross/deterministic.pxd":260
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class Spp(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the Spp class generates a custome-made compartment epidemic model.
 */
struct __pyx_obj_6pyross_13deterministic_Spp {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  int constant_CM;
  PyArrayObject *constant_terms;
  PyArrayObject *linear_terms;
  PyArrayObject *infection_terms;
  PyArrayObject *finres_terms;
  PyArrayObject *resource_list;
  PyArrayObject *parameters;
  PyArrayObject *parameters_length;
  PyObject *param_keys;
  PyObject *param_dict;
  PyObject *class_index_dict;
  PyArrayObject *_lambdas;
  PyObject *time_dep_param_mapping;
  PyArrayObject *finres_pop;
  PyArrayObject *nonzero_index_n;
};


/* "pyross/deterministic.pxd":284
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class SppSparse(Spp):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the Spp class generates a custome-made compartment epidemic model.
 */
struct __pyx_obj_6pyross_13deterministic_SppSparse {
  struct __pyx_obj_6pyross_13deterministic_Spp __pyx_base;
  int intCounter;
  PyArrayObject *interactingMP;
};


/* "pyross/deterministic.pxd":298
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class SppQ(Spp):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the SppQ class generates a custome-made model just like Spp, but automatically adds a quarantined version of every compartment
 */
struct __pyx_obj_6pyross_13deterministic_SppQ {
  struct __pyx_obj_6pyross_13deterministic_Spp __pyx_base;
  PyObject *full_model_spec;
  PyObject *input_time_dep_param_mapping;
  PyObject *testRate;
};


/* "pyross/deterministic.pxd":316
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class SppQ_old(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the SppQ class generates a custome-made model just like Spp, but automatically adds a quarantined version of every compartment
 */
struct __pyx_obj_6pyross_13deterministic_SppQ_old {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  PyArrayObject *constant_terms;
  PyArrayObject *linear_terms;
  PyArrayObject *infection_terms;
  PyArrayObject *test_pos;
  PyArrayObject *test_freq;
  PyArrayObject *parameters;
  PyObject *param_keys;
  PyObject *class_index_dict;
  PyObject *param_dict;
  PyArrayObject *_lambdas;
  int nClassU;
  PyObject *testRate;
  PyObject *time_dep_param_mapping;
};


/* "pyross/deterministic.pxd":342
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEI5R(CommonMethods):             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly double beta, gE, gA, gIa, gIs, fsa
 */
struct __pyx_obj_6pyross_13deterministic_SEI5R {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gA;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/deterministic.pxd":363
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAI5R(CommonMethods):             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly double beta, gE, gA, gIa, gIs, fsa
 */
struct __pyx_obj_6pyross_13deterministic_SEAI5R {
  struct __pyx_obj_6pyross_13deterministic_CommonMethods __pyx_base;
  double beta;
  double gE;
  double gA;
  double gIa;
  double gIs;
  double fsa;
};


/* "pyross/inference.pyx":54
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIR_type:             # <<<<<<<<<<<<<<
 *     '''Parent class for inference for all SIR-type classes listed below
 * 
 */
struct __pyx_obj_6pyross_9inference_SIR_type {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type *__pyx_vtab;
  Py_ssize_t nClass;
  Py_ssize_t M;
  Py_ssize_t steps;
  Py_ssize_t dim;
  Py_ssize_t vec_size;
  double Omega;
  double rtol_det;
  double rtol_lyapunov;
  PyArrayObject *beta;
  PyArrayObject *gIa;
  PyArrayObject *gIs;
  PyArrayObject *fsa;
  PyArrayObject *_xm;
  PyArrayObject *alpha;
  PyArrayObject *fi;
  PyArrayObject *CM;
  PyArrayObject *dsigmadt;
  PyArrayObject *J;
  PyArrayObject *B;
  PyArrayObject *J_mat;
  PyArrayObject *B_vec;
  PyArrayObject *U;
  PyArrayObject *flat_indices1;
  PyArrayObject *flat_indices2;
  PyArrayObject *flat_indices;
  PyArrayObject *rows;
  PyArrayObject *cols;
  PyObject *det_method;
  PyObject *lyapunov_method;
  PyObject *class_index_dict;
  PyObject *param_keys;
  PyObject *_interp;
  PyObject *contactMatrix;
  int param_mapping_enabled;
};


/* "pyross/inference.pyx":3628
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIR(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIR)
 */
struct __pyx_obj_6pyross_9inference_SIR {
  struct __pyx_obj_6pyross_9inference_SIR_type __pyx_base;
  struct __pyx_obj_6pyross_13deterministic_SIR *det_model;
};


/* "pyross/inference.pyx":3758
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEIR(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Infected, Removed (SEIR)
 */
struct __pyx_obj_6pyross_9inference_SEIR {
  struct __pyx_obj_6pyross_9inference_SIR_type __pyx_base;
  PyArrayObject *gE;
  struct __pyx_obj_6pyross_13deterministic_SEIR *det_model;
};


/* "pyross/inference.pyx":3901
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */
struct __pyx_obj_6pyross_9inference_SEAIRQ {
  struct __pyx_obj_6pyross_9inference_SIR_type __pyx_base;
  PyArrayObject *gE;
  PyArrayObject *gA;
  PyArrayObject *tE;
  PyArrayObject *tA;
  PyArrayObject *tIa;
  PyArrayObject *tIs;
  struct __pyx_obj_6pyross_13deterministic_SEAIRQ *det_model;
};


/* "pyross/inference.pyx":4086
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ_testing(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */
struct __pyx_obj_6pyross_9inference_SEAIRQ_testing {
  struct __pyx_obj_6pyross_9inference_SIR_type __pyx_base;
  PyArrayObject *gE;
  PyArrayObject *gA;
  PyArrayObject *ars;
  PyArrayObject *kapE;
  PyObject *testRate;
  struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *det_model;
};


/* "pyross/inference.pyx":4310
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class Spp(SIR_type):             # <<<<<<<<<<<<<<
 *     """User-defined epidemic model.
 * 
 */
struct __pyx_obj_6pyross_9inference_Spp {
  struct __pyx_obj_6pyross_9inference_SIR_type __pyx_base;
  PyArrayObject *constant_terms;
  PyArrayObject *linear_terms;
  PyArrayObject *infection_terms;
  PyArrayObject *finres_terms;
  PyArrayObject *resource_list;
  PyArrayObject *model_parameters;
  PyArrayObject *model_parameters_length;
  PyArrayObject *finres_pop;
  struct __pyx_obj_6pyross_13deterministic_Spp *det_model;
  PyObject *model_spec;
  PyObject *param_dict;
  PyObject *model_param_keys;
  PyObject *parameter_mapping;
  PyObject *time_dep_param_mapping;
};


/* "pyross/inference.pyx":4739
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SppQ(Spp):             # <<<<<<<<<<<<<<
 *     """User-defined epidemic model with quarantine stage.
 * 
 */
struct __pyx_obj_6pyross_9inference_SppQ {
  struct __pyx_obj_6pyross_9inference_Spp __pyx_base;
  PyObject *full_model_spec;
  PyObject *input_time_dep_param_mapping;
  PyObject *input_param_mapping;
  PyObject *testRate;
};


/* "pyross/inference.pyx":4847
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SppQ_old(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     No longer maintained, will be deprecated.
 */
struct __pyx_obj_6pyross_9inference_SppQ_old {
  struct __pyx_obj_6pyross_9inference_SIR_type __pyx_base;
  PyArrayObject *constant_terms;
  PyArrayObject *linear_terms;
  PyArrayObject *infection_terms;
  PyArrayObject *test_pos;
  PyArrayObject *test_freq;
  Py_ssize_t nClassU;
  Py_ssize_t nClassUwoN;
  PyArrayObject *model_parameters;
  struct __pyx_obj_6pyross_13deterministic_SppQ_old *det_model;
  PyObject *model_spec;
  PyObject *param_dict;
  PyObject *model_param_keys;
  PyObject *parameter_mapping;
  PyObject *time_dep_param_mapping;
  PyObject *testRate;
};


/* "pyross/inference.pyx":5232
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 * 
 * cdef class SppSparse(Spp):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi, Omega=1, steps=4,
 */
struct __pyx_obj_6pyross_9inference_SppSparse {
  struct __pyx_obj_6pyross_9inference_Spp __pyx_base;
};


/* "pyross/inference.pyx":945
 * 
 * 
 *     def FIM(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *             intervention_fun=None, tangent=False, eps=None, inter_steps=100):
 *         '''
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM {
  PyObject_HEAD
  PyObject *__pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix;
  PyObject *__pyx_v_generator;
  PyObject *__pyx_v_inter_steps;
  PyObject *__pyx_v_intervention_fun;
  PyObject *__pyx_v_kwargs;
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_tangent;
  PyObject *__pyx_v_x0;
};


/* "pyross/inference.pyx":1051
 * 
 * 
 *     def FIM_det(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, eps=None, measurement_error=1e-2,
 *                 inter_steps=100):
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det {
  PyObject_HEAD
  PyObject *__pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix;
  PyObject *__pyx_v_generator;
  PyObject *__pyx_v_inter_steps;
  PyObject *__pyx_v_intervention_fun;
  PyObject *__pyx_v_kwargs;
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_x0;
};


/* "pyross/inference.pyx":1147
 * 
 * 
 *     def hessian(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, tangent=False, eps=None,
 *                 fd_method="central", inter_steps=0):
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian {
  PyObject_HEAD
  PyObject *__pyx_v_Tf;
  PyObject *__pyx_v_kwargs;
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_tangent;
  PyObject *__pyx_v_x;
};


/* "pyross/inference.pyx":1216
 *         return hess
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,             # <<<<<<<<<<<<<<
 *                    range_1, range_2, resolution_1, resolution_2=None):
 *         '''
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness {
  PyObject_HEAD
  PyObject *__pyx_v_FIM;
  PyObject *__pyx_v_FIM_det;
  PyObject *__pyx_v_flat_maps;
  PyObject *__pyx_v_param_pos_1;
  PyObject *__pyx_v_param_pos_2;
};


/* "pyross/inference.pyx":2537
 *         return cov_red
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                    generator=None,
 *                    intervention_fun=None, tangent=False, eps=None,
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM {
  PyObject_HEAD
  PyObject *__pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix;
  PyObject *__pyx_v_fltr;
  PyObject *__pyx_v_generator;
  PyObject *__pyx_v_inter_steps;
  PyObject *__pyx_v_intervention_fun;
  PyObject *__pyx_v_kwargs;
  PyObject *__pyx_v_obs;
  PyObject *__pyx_v_obs0;
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_tangent;
};


/* "pyross/inference.pyx":2652
 *         return FIM
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,             # <<<<<<<<<<<<<<
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det {
  PyObject_HEAD
  PyObject *__pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix;
  PyObject *__pyx_v_fltr;
  PyObject *__pyx_v_generator;
  PyObject *__pyx_v_inter_steps;
  PyObject *__pyx_v_intervention_fun;
  PyObject *__pyx_v_kwargs;
  PyObject *__pyx_v_obs;
  PyObject *__pyx_v_obs0;
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
};


/* "pyross/inference.pyx":2757
 *         return FIM_det
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=0):
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian {
  PyObject_HEAD
  PyObject *__pyx_v_Tf;
  PyObject *__pyx_v_fltr;
  PyObject *__pyx_v_kwargs;
  PyObject *__pyx_v_obs;
  PyObject *__pyx_v_obs0;
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_tangent;
};


/* "pyross/inference.pyx":3388
 *         return log_cond_p
 * 
 *     cdef _estimate_cond_cov(self, object sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] cov_vec, sigma0=np.zeros((self.vec_size), dtype=DTYPE)
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov {
  PyObject_HEAD
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_sol;
};


/* "pyross/inference.pyx":3511
 *                 xi[i] -= epsilon
 * 
 *     def _obtain_time_evol_op(self, sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t steps=self.steps
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op {
  PyObject_HEAD
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
  PyObject *__pyx_v_sol;
};


/* "pyross/inference.pyx":3583
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,             # <<<<<<<<<<<<<<
 *                   dense_output=False, maxNumSteps=100000):
 *         """An light weight integrate method similar to `simulate` in pyross.deterministic
 */
struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate {
  PyObject_HEAD
  struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self;
};


/* "View.MemoryView":105
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_array_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_array *__pyx_vtab;
  char *data;
  Py_ssize_t len;
  char *format;
  int ndim;
  Py_ssize_t *_shape;
  Py_ssize_t *_strides;
  Py_ssize_t itemsize;
  PyObject *mode;
  PyObject *_format;
  void (*callback_free_data)(void *);
  int free_data;
  int dtype_is_object;
};


/* "View.MemoryView":279
 * 
 * @cname('__pyx_MemviewEnum')
 * cdef class Enum(object):             # <<<<<<<<<<<<<<
 *     cdef object name
 *     def __init__(self, name):
 */
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":330
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  PyObject *_array_interface;
  PyThread_type_lock lock;
  __pyx_atomic_int acquisition_count[2];
  __pyx_atomic_int *acquisition_count_aligned_p;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo *typeinfo;
};


/* "View.MemoryView":961
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */
struct __pyx_memoryviewslice_obj {
  struct __pyx_memoryview_obj __pyx_base;
  __Pyx_memviewslice from_slice;
  PyObject *from_object;
  PyObject *(*to_object_func)(char *);
  int (*to_dtype_func)(char *, PyObject *);
};



/* "pyross/deterministic.pxd":7
 * ctypedef np.float_t DTYPE_t
 * 
 * cdef class CommonMethods:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly int N, M, kI, kE, nClass
 */

struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods {
  PyObject *(*set_contactMatrix)(struct __pyx_obj_6pyross_13deterministic_CommonMethods *, double, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods *__pyx_vtabptr_6pyross_13deterministic_CommonMethods;


/* "pyross/deterministic.pxd":25
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIR)
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SIR {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SIR *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SIR *__pyx_vtabptr_6pyross_13deterministic_SIR;


/* "pyross/deterministic.pxd":45
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIRS(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed, Susceptible (SIRS)
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SIRS {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SIRS *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SIRS *__pyx_vtabptr_6pyross_13deterministic_SIRS;


/* "pyross/deterministic.pxd":63
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEIR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Infected, Removed (SEIR)
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEIR {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEIR *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEIR *__pyx_vtabptr_6pyross_13deterministic_SEIR;


/* "pyross/deterministic.pxd":78
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEI8R(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Infected, Removed (SEIR). The infected class has 5 groups.
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEI8R {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEI8R *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEI8R *__pyx_vtabptr_6pyross_13deterministic_SEI8R;


/* "pyross/deterministic.pxd":110
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIkR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIkR). Method of k-stages of I
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SIkR {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SIkR *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SIkR *__pyx_vtabptr_6pyross_13deterministic_SIkR;


/* "pyross/deterministic.pxd":125
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEkIkR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIkR). Method of k-stages of I
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEkIkR {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEkIkR *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEkIkR *__pyx_vtabptr_6pyross_13deterministic_SEkIkR;


/* "pyross/deterministic.pxd":142
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEkIkIkR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIkR). Method of k-stages of I
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEkIkIkR {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEkIkIkR *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEkIkIkR *__pyx_vtabptr_6pyross_13deterministic_SEkIkIkR;


/* "pyross/deterministic.pxd":159
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIR(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed (SEAIR)
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEAIR {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEAIR *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEAIR *__pyx_vtabptr_6pyross_13deterministic_SEAIR;


/* "pyross/deterministic.pxd":179
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAI8R(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Activates, Infected, Removed (SEAIR). The infected class has 5 groups:
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEAI8R {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEAI8R *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEAI8R *__pyx_vtabptr_6pyross_13deterministic_SEAI8R;


/* "pyross/deterministic.pxd":210
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEAIRQ *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ *__pyx_vtabptr_6pyross_13deterministic_SEAIRQ;


/* "pyross/deterministic.pxd":234
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ_testing(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ_testing {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*set_testRate)(struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ_testing *__pyx_vtabptr_6pyross_13deterministic_SEAIRQ_testing;


/* "pyross/deterministic.pxd":260
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class Spp(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the Spp class generates a custome-made compartment epidemic model.
 */

struct __pyx_vtabstruct_6pyross_13deterministic_Spp {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_Spp *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_Spp *__pyx_vtabptr_6pyross_13deterministic_Spp;


/* "pyross/deterministic.pxd":284
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class SppSparse(Spp):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the Spp class generates a custome-made compartment epidemic model.
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SppSparse {
  struct __pyx_vtabstruct_6pyross_13deterministic_Spp __pyx_base;
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SppSparse *__pyx_vtabptr_6pyross_13deterministic_SppSparse;


/* "pyross/deterministic.pxd":298
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class SppQ(Spp):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the SppQ class generates a custome-made model just like Spp, but automatically adds a quarantined version of every compartment
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SppQ {
  struct __pyx_vtabstruct_6pyross_13deterministic_Spp __pyx_base;
  PyObject *(*set_testRate)(struct __pyx_obj_6pyross_13deterministic_SppQ *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*full_time_dep_param_mapping)(struct __pyx_obj_6pyross_13deterministic_SppQ *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SppQ *__pyx_vtabptr_6pyross_13deterministic_SppQ;


/* "pyross/deterministic.pxd":316
 * @cython.cdivision(False)
 * @cython.nonecheck(True)
 * cdef class SppQ_old(CommonMethods):             # <<<<<<<<<<<<<<
 *     """
 *     Given a model specification, the SppQ class generates a custome-made model just like Spp, but automatically adds a quarantined version of every compartment
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SppQ_old {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SppQ_old *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*set_testRate)(struct __pyx_obj_6pyross_13deterministic_SppQ_old *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SppQ_old *__pyx_vtabptr_6pyross_13deterministic_SppQ_old;


/* "pyross/deterministic.pxd":342
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEI5R(CommonMethods):             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly double beta, gE, gA, gIa, gIs, fsa
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEI5R {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEI5R *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEI5R *__pyx_vtabptr_6pyross_13deterministic_SEI5R;


/* "pyross/deterministic.pxd":363
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAI5R(CommonMethods):             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly double beta, gE, gA, gIa, gIs, fsa
 */

struct __pyx_vtabstruct_6pyross_13deterministic_SEAI5R {
  struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods __pyx_base;
  PyObject *(*rhs)(struct __pyx_obj_6pyross_13deterministic_SEAI5R *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_13deterministic_SEAI5R *__pyx_vtabptr_6pyross_13deterministic_SEAI5R;


/* "pyross/inference.pyx":54
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIR_type:             # <<<<<<<<<<<<<<
 *     '''Parent class for inference for all SIR-type classes listed below
 * 
 */

struct __pyx_vtabstruct_6pyross_9inference_SIR_type {
  PyArrayObject *(*_get_r_from_x)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *);
  double (*_penalty_from_negative_values)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *);
  PyObject *(*find_fastest_growing_lin_mode)(struct __pyx_obj_6pyross_9inference_SIR_type *, double, int __pyx_skip_dispatch);
  double (*_obtain_logp_for_traj)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj *__pyx_optional_args);
  double (*_obtain_logp_for_lat_traj)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, __Pyx_memviewslice, PyArrayObject *, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj *__pyx_optional_args);
  double (*_obtain_logp_for_traj_tangent)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double);
  double (*_log_cond_p)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*_estimate_cond_cov)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, double, double);
  PyObject *(*obtain_full_mean_cov)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov *__pyx_optional_args);
  PyObject *(*interpolate_euler)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*obtain_full_mean_cov_tangent_space)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space *__pyx_optional_args);
  PyObject *(*_rhs0)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_obtain_time_evol_op_2)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, double, double, int __pyx_skip_dispatch);
  PyObject *(*_compute_dsigdt)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice);
  PyObject *(*convert_vec_to_mat)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, int __pyx_skip_dispatch);
  PyObject *(*compute_jacobian_and_b_matrix)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args);
};
static struct __pyx_vtabstruct_6pyross_9inference_SIR_type *__pyx_vtabptr_6pyross_9inference_SIR_type;


/* "pyross/inference.pyx":3628
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SIR(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Infected, Removed (SIR)
 */

struct __pyx_vtabstruct_6pyross_9inference_SIR {
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_base;
  PyObject *(*fill_lambdas)(struct __pyx_obj_6pyross_9inference_SIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*jacobian)(struct __pyx_obj_6pyross_9inference_SIR *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*noise_correlation)(struct __pyx_obj_6pyross_9inference_SIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
};
static struct __pyx_vtabstruct_6pyross_9inference_SIR *__pyx_vtabptr_6pyross_9inference_SIR;


/* "pyross/inference.pyx":3758
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEIR(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Infected, Removed (SEIR)
 */

struct __pyx_vtabstruct_6pyross_9inference_SEIR {
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_base;
  PyObject *(*fill_lambdas)(struct __pyx_obj_6pyross_9inference_SEIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*jacobian)(struct __pyx_obj_6pyross_9inference_SEIR *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*noise_correlation)(struct __pyx_obj_6pyross_9inference_SEIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
};
static struct __pyx_vtabstruct_6pyross_9inference_SEIR *__pyx_vtabptr_6pyross_9inference_SEIR;


/* "pyross/inference.pyx":3901
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */

struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ {
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_base;
  PyObject *(*fill_lambdas)(struct __pyx_obj_6pyross_9inference_SEAIRQ *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*jacobian)(struct __pyx_obj_6pyross_9inference_SEAIRQ *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*noise_correlation)(struct __pyx_obj_6pyross_9inference_SEAIRQ *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
};
static struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ *__pyx_vtabptr_6pyross_9inference_SEAIRQ;


/* "pyross/inference.pyx":4086
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SEAIRQ_testing(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)
 */

struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ_testing {
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_base;
  PyObject *(*fill_lambdas)(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*jacobian)(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*noise_correlation)(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
};
static struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ_testing *__pyx_vtabptr_6pyross_9inference_SEAIRQ_testing;


/* "pyross/inference.pyx":4310
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class Spp(SIR_type):             # <<<<<<<<<<<<<<
 *     """User-defined epidemic model.
 * 
 */

struct __pyx_vtabstruct_6pyross_9inference_Spp {
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_base;
  PyObject *(*fill_lambdas)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*fill_finres_pop)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice);
  PyObject *(*jacobian)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*noise_correlation)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice, __Pyx_memviewslice);
};
static struct __pyx_vtabstruct_6pyross_9inference_Spp *__pyx_vtabptr_6pyross_9inference_Spp;


/* "pyross/inference.pyx":4739
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SppQ(Spp):             # <<<<<<<<<<<<<<
 *     """User-defined epidemic model with quarantine stage.
 * 
 */

struct __pyx_vtabstruct_6pyross_9inference_SppQ {
  struct __pyx_vtabstruct_6pyross_9inference_Spp __pyx_base;
  PyObject *(*full_time_dep_param_mapping)(struct __pyx_obj_6pyross_9inference_SppQ *, PyObject *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pyross_9inference_SppQ *__pyx_vtabptr_6pyross_9inference_SppQ;


/* "pyross/inference.pyx":4847
 * @cython.cdivision(True)
 * @cython.nonecheck(False)
 * cdef class SppQ_old(SIR_type):             # <<<<<<<<<<<<<<
 *     """
 *     No longer maintained, will be deprecated.
 */

struct __pyx_vtabstruct_6pyross_9inference_SppQ_old {
  struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_base;
  PyArrayObject *(*_get_rq_from_x)(struct __pyx_obj_6pyross_9inference_SppQ_old *, PyArrayObject *);
  PyObject *(*calculate_test_r)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice, double);
  PyObject *(*fill_lambdas)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice);
  PyObject *(*jacobian)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, double, double);
  PyObject *(*noise_correlation)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, double);
};
static struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *__pyx_vtabptr_6pyross_9inference_SppQ_old;


/* "pyross/inference.pyx":5232
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 * 
 * cdef class SppSparse(Spp):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi, Omega=1, steps=4,
 */

struct __pyx_vtabstruct_6pyross_9inference_SppSparse {
  struct __pyx_vtabstruct_6pyross_9inference_Spp __pyx_base;
};
static struct __pyx_vtabstruct_6pyross_9inference_SppSparse *__pyx_vtabptr_6pyross_9inference_SppSparse;


/* "View.MemoryView":105
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_array {
  PyObject *(*get_memview)(struct __pyx_array_obj *);
};
static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;


/* "View.MemoryView":330
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */

struct __pyx_vtabstruct_memoryview {
  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":961
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* MemviewSliceInit.proto */
#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
#define __Pyx_MEMVIEW_DIRECT   1
#define __Pyx_MEMVIEW_PTR      2
#define __Pyx_MEMVIEW_FULL     4
#define __Pyx_MEMVIEW_CONTIG   8
#define __Pyx_MEMVIEW_STRIDED  16
#define __Pyx_MEMVIEW_FOLLOW   32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_TrueDivideCObj(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* MatrixMultiply.proto */
#if PY_VERSION_HEX >= 0x03050000
  #define __Pyx_PyNumber_MatrixMultiply(x,y)         PyNumber_MatrixMultiply(x,y)
  #define __Pyx_PyNumber_InPlaceMatrixMultiply(x,y)  PyNumber_InPlaceMatrixMultiply(x,y)
#else
#define __Pyx_PyNumber_MatrixMultiply(x,y)         __Pyx__PyNumber_MatrixMultiply(x, y, "@")
static PyObject* __Pyx__PyNumber_MatrixMultiply(PyObject* x, PyObject* y, const char* op_name);
static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y);
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* IsLittleEndian.proto */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type);

/* BufferGetAndValidate.proto */
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
    ((obj == Py_None || obj == NULL) ?\
    (__Pyx_ZeroBuffer(buf), 0) :\
    __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static void __Pyx_ZeroBuffer(Py_buffer* buf);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

/* BufferFallbackError.proto */
static void __Pyx_RaiseBufferFallbackError(void);

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* None.proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __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));

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

/* MemviewSliceIsContig.proto */
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);

/* OverlappingSlices.proto */
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                                __Pyx_memviewslice *slice2,
                                int ndim, size_t itemsize);

/* Capsule.proto */
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);

/* TypeInfoCompare.proto */
static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);

/* MemviewSliceValidateAndInit.proto */
static int __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);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj);

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);

/* MemviewSliceCopyTemplate.proto */
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);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *, int writable_flag);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag);

/* CStringEquals.proto */
static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static PyArrayObject *__pyx_f_6pyross_9inference_8SIR_type__get_r_from_x(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_x); /* proto*/
static double __pyx_f_6pyross_9inference_8SIR_type__penalty_from_negative_values(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_x0); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_find_fastest_growing_lin_mode(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, double __pyx_v_t, int __pyx_skip_dispatch); /* proto*/
static double __pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_traj(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_Tf, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj *__pyx_optional_args); /* proto*/
static double __pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, __Pyx_memviewslice __pyx_v_obs_flattened, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj *__pyx_optional_args); /* proto*/
static double __pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_traj_tangent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_Tf); /* proto*/
static double __pyx_f_6pyross_9inference_8SIR_type__log_cond_p(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_cov); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type__estimate_cond_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_obtain_full_mean_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_interpolate_euler(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type__rhs0(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_xt, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type__obtain_time_evol_op_2(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type__compute_dsigdt(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_sig); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_convert_vec_to_mat(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_cov, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_x, CYTHON_UNUSED double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3SIR_fill_lambdas(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3SIR_jacobian(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3SIR_noise_correlation(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_4SEIR_fill_lambdas(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_4SEIR_jacobian(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_4SEIR_noise_correlation(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_fill_lambdas(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_jacobian(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_noise_correlation(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_q, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_fill_lambdas(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_jacobian(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_q, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_TR); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_noise_correlation(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_q, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_TR); /* proto*/
static PyArrayObject *__pyx_f_6pyross_9inference_3Spp__get_r_from_x(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyArrayObject *__pyx_v_x); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3Spp_fill_lambdas(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3Spp_fill_finres_pop(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3Spp_jacobian(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_3Spp_noise_correlation(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_4SppQ_full_time_dep_param_mapping(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_input_parameters, PyObject *__pyx_v_t, int __pyx_skip_dispatch); /* proto*/
static PyArrayObject *__pyx_f_6pyross_9inference_8SppQ_old__get_r_from_x(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x); /* proto*/
static PyArrayObject *__pyx_f_6pyross_9inference_8SppQ_old__get_rq_from_x(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x); /* proto*/
static double __pyx_f_6pyross_9inference_8SppQ_old__penalty_from_negative_values(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x0); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_calculate_test_r(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_r, double __pyx_v_TR); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_fill_lambdas(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_jacobian(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_r, double __pyx_v_ntestpop, double __pyx_v_tau0); /* proto*/
static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_noise_correlation(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_r, double __pyx_v_tau0); /* proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
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*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/

/* Module declarations from 'cython.view' */

/* Module declarations from 'cython' */

/* Module declarations from 'pyross.deterministic' */
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_CommonMethods = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SIR = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SIRS = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEIR = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEI8R = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SIkR = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEkIkR = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEkIkIkR = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEAIR = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEAI8R = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEAIRQ = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEAIRQ_testing = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_Spp = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SppSparse = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SppQ = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SppQ_old = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEI5R = 0;
static PyTypeObject *__pyx_ptype_6pyross_13deterministic_SEAI5R = 0;

/* Module declarations from 'pyross' */

/* Module declarations from 'libc.math' */

/* Module declarations from 'pyross.inference' */
static PyTypeObject *__pyx_ptype_6pyross_9inference_SIR_type = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SIR = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SEIR = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SEAIRQ = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SEAIRQ_testing = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_Spp = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SppQ = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SppQ_old = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference_SppSparse = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct__FIM = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_1_FIM_det = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_2_hessian = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_3_robustness = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_4_latent_FIM = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_6_latent_hessian = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op = 0;
static PyTypeObject *__pyx_ptype_6pyross_9inference___pyx_scope_struct_9_integrate = 0;
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static double __pyx_v_6pyross_9inference_PI;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SIR_type__set_state(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SIR__set_state(struct __pyx_obj_6pyross_9inference_SIR *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SEIR__set_state(struct __pyx_obj_6pyross_9inference_SEIR *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ__set_state(struct __pyx_obj_6pyross_9inference_SEAIRQ *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ_testing__set_state(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_Spp__set_state(struct __pyx_obj_6pyross_9inference_Spp *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SppQ__set_state(struct __pyx_obj_6pyross_9inference_SppQ *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SppQ_old__set_state(struct __pyx_obj_6pyross_9inference_SppQ_old *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SppSparse__set_state(struct __pyx_obj_6pyross_9inference_SppSparse *, PyObject *); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
static void *__pyx_align_pointer(void *, size_t); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
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*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_6pyross_9inference_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
#define __Pyx_MODULE_NAME "pyross.inference"
extern int __pyx_module_is_main_pyross__inference;
int __pyx_module_is_main_pyross__inference = 0;

/* Implementation of 'pyross.inference' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_all;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_IndexError;
static const char __pyx_k_A[] = "A";
static const char __pyx_k_E[] = "E";
static const char __pyx_k_M[] = "M";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_O[] = "O";
static const char __pyx_k_Q[] = "Q";
static const char __pyx_k_R[] = "R";
static const char __pyx_k_S[] = "S";
static const char __pyx_k_T[] = "T";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_Ia[] = "Ia";
static const char __pyx_k_Is[] = "Is";
static const char __pyx_k_M0[] = "M0";
static const char __pyx_k_Nf[] = "Nf";
static const char __pyx_k_Tf[] = "Tf";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_fi[] = "fi";
static const char __pyx_k_gA[] = "gA";
static const char __pyx_k_gE[] = "gE";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_pi[] = "pi";
static const char __pyx_k_rq[] = "rq";
static const char __pyx_k_t1[] = "t1";
static const char __pyx_k_t2[] = "t2";
static const char __pyx_k_tA[] = "tA";
static const char __pyx_k_tE[] = "tE";
static const char __pyx_k_tS[] = "tS";
static const char __pyx_k_x0[] = "x0";
static const char __pyx_k_xt[] = "xt";
static const char __pyx_k_FIM[] = "FIM";
static const char __pyx_k_Inf[] = "Inf";
static const char __pyx_k_RK2[] = "RK2";
static const char __pyx_k_SIR[] = "SIR";
static const char __pyx_k_Spp[] = "Spp";
static const char __pyx_k__75[] = "*";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_ars[] = "ars";
static const char __pyx_k_cov[] = "_cov";
static const char __pyx_k_det[] = "det";
static const char __pyx_k_dev[] = "dev";
static const char __pyx_k_dot[] = "dot";
static const char __pyx_k_eig[] = "eig";
static const char __pyx_k_eps[] = "eps";
static const char __pyx_k_exp[] = "exp";
static const char __pyx_k_eye[] = "eye";
static const char __pyx_k_fsa[] = "fsa";
static const char __pyx_k_gIa[] = "gIa";
static const char __pyx_k_gIs[] = "gIs";
static const char __pyx_k_inv[] = "inv";
static const char __pyx_k_log[] = "log";
static const char __pyx_k_map[] = "map";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_obs[] = "obs";
static const char __pyx_k_ord[] = "ord";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_ppf[] = "ppf";
static const char __pyx_k_rhs[] = "rhs";
static const char __pyx_k_sig[] = "sig";
static const char __pyx_k_sol[] = "sol";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_tIa[] = "tIa";
static const char __pyx_k_tIs[] = "tIs";
static const char __pyx_k_tau[] = "tau";
static const char __pyx_k_var[] = "var";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_RK45[] = "RK45";
static const char __pyx_k_SEIR[] = "SEIR";
static const char __pyx_k_SppQ[] = "SppQ";
static const char __pyx_k_axis[] = "axis";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_bool[] = "bool";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_dUdt[] = "dUdt";
static const char __pyx_k_diag[] = "diag";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_dill[] = "dill";
static const char __pyx_k_dxdt[] = "dxdt";
static const char __pyx_k_flat[] = "flat";
static const char __pyx_k_fltr[] = "fltr";
static const char __pyx_k_ftol[] = "ftol";
static const char __pyx_k_full[] = "full";
static const char __pyx_k_grad[] = "grad";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_intp[] = "intp";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_kapE[] = "kapE";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_kind[] = "kind";
static const char __pyx_k_logl[] = "logl";
static const char __pyx_k_logz[] = "logz";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_mean[] = "_mean";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_norm[] = "norm";
static const char __pyx_k_obs0[] = "obs0";
static const char __pyx_k_pack[] = "pack";
static const char __pyx_k_pool[] = "pool";
static const char __pyx_k_quad[] = "quad";
static const char __pyx_k_rand[] = "rand";
static const char __pyx_k_rhs0[] = "_rhs0";
static const char __pyx_k_rtol[] = "rtol";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_sqrt[] = "sqrt";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_thin[] = "thin";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_Array[] = "Array";
static const char __pyx_k_DTYPE[] = "DTYPE";
static const char __pyx_k_LSODA[] = "LSODA";
static const char __pyx_k_Omega[] = "Omega";
static const char __pyx_k_Prior[] = "Prior";
static const char __pyx_k_U_mat[] = "U_mat";
static const char __pyx_k_U_vec[] = "U_vec";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_cov_2[] = "cov";
static const char __pyx_k_dlogz[] = "dlogz";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_emcee[] = "emcee";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_euler[] = "euler";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_float[] = "float";
static const char __pyx_k_fltr0[] = "fltr0";
static const char __pyx_k_fltrs[] = "fltrs";
static const char __pyx_k_infer[] = "infer";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_logwt[] = "logwt";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_point[] = "point";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_prior[] = "prior";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_ravel[] = "ravel";
static const char __pyx_k_scipy[] = "scipy";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_solve[] = "solve";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_steps[] = "steps";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_sympy[] = "sympy";
static const char __pyx_k_trace[] = "trace";
static const char __pyx_k_utils[] = "utils";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_SEAIRQ[] = "SEAIRQ";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_astype[] = "astype";
static const char __pyx_k_bounds[] = "bounds";
static const char __pyx_k_divide[] = "divide";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_invert[] = "invert";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_linalg[] = "linalg";
static const char __pyx_k_linear[] = "linear";
static const char __pyx_k_logpdf[] = "logpdf";
static const char __pyx_k_map_x0[] = "map_x0";
static const char __pyx_k_matmul[] = "__matmul__";
static const char __pyx_k_mean_2[] = "mean";
static const char __pyx_k_method[] = "method";
static const char __pyx_k_nClass[] = "nClass";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_params[] = "params";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_pyross[] = "pyross";
static const char __pyx_k_random[] = "random";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_repeat[] = "repeat";
static const char __pyx_k_rhs0_2[] = "rhs0";
static const char __pyx_k_sparse[] = "sparse";
static const char __pyx_k_struct[] = "struct";
static const char __pyx_k_t_eval[] = "t_eval";
static const char __pyx_k_unpack[] = "unpack";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_vstack[] = "vstack";
static const char __pyx_k_weight[] = "weight";
static const char __pyx_k_FIM_det[] = "FIM_det";
static const char __pyx_k_Inverse[] = "Inverse";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_central[] = "central";
static const char __pyx_k_discard[] = "discard";
static const char __pyx_k_dynesty[] = "dynesty";
static const char __pyx_k_flatten[] = "flatten";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_hashlib[] = "hashlib";
static const char __pyx_k_hessian[] = "hessian";
static const char __pyx_k_imatmul[] = "__imatmul__";
static const char __pyx_k_isclose[] = "isclose";
static const char __pyx_k_loglike[] = "_loglike";
static const char __pyx_k_lognorm[] = "lognorm";
static const char __pyx_k_maxcall[] = "maxcall";
static const char __pyx_k_maxiter[] = "maxiter";
static const char __pyx_k_memview[] = "memview";
static const char __pyx_k_minimum[] = "minimum";
static const char __pyx_k_param_1[] = "param_1";
static const char __pyx_k_param_2[] = "param_2";
static const char __pyx_k_range_1[] = "range_1";
static const char __pyx_k_range_2[] = "range_2";
static const char __pyx_k_repeats[] = "repeats";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_results[] = "results";
static const char __pyx_k_rmatmul[] = "__rmatmul__";
static const char __pyx_k_sampler[] = "sampler";
static const char __pyx_k_samples[] = "samples";
static const char __pyx_k_spacing[] = "spacing";
static const char __pyx_k_tangent[] = "tangent";
static const char __pyx_k_verbose[] = "verbose";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_SIR_type[] = "SIR_type";
static const char __pyx_k_SppQ_old[] = "SppQ_old";
static const char __pyx_k_add_live[] = "add_live";
static const char __pyx_k_allclose[] = "allclose";
static const char __pyx_k_bilinear[] = "bilinear";
static const char __pyx_k_cma_stds[] = "cma_stds";
static const char __pyx_k_compress[] = "compress";
static const char __pyx_k_diagonal[] = "diagonal";
static const char __pyx_k_eigvalsh[] = "eigvalsh";
static const char __pyx_k_flat_map[] = "flat_map";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_gradient[] = "gradient";
static const char __pyx_k_identity[] = "identity";
static const char __pyx_k_interp1d[] = "interp1d";
static const char __pyx_k_isscalar[] = "isscalar";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_linspace[] = "linspace";
static const char __pyx_k_map_dict[] = "map_dict";
static const char __pyx_k_max_step[] = "max_step";
static const char __pyx_k_meshgrid[] = "meshgrid";
static const char __pyx_k_minimize[] = "minimize";
static const char __pyx_k_multiply[] = "multiply";
static const char __pyx_k_nsamples[] = "nsamples";
static const char __pyx_k_nwalkers[] = "nwalkers";
static const char __pyx_k_progress[] = "progress";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_rtol_det[] = "rtol_det";
static const char __pyx_k_run_mcmc[] = "run_mcmc";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_subtract[] = "subtract";
static const char __pyx_k_testRate[] = "testRate";
static const char __pyx_k_SppSparse[] = "SppSparse";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_args_dict[] = "args_dict";
static const char __pyx_k_cpu_count[] = "cpu_count";
static const char __pyx_k_det_model[] = "det_model";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_fd_method[] = "fd_method";
static const char __pyx_k_generator[] = "generator";
static const char __pyx_k_get_chain[] = "get_chain";
static const char __pyx_k_integrate[] = "integrate";
static const char __pyx_k_itertools[] = "itertools";
static const char __pyx_k_log_prior[] = "log_prior";
static const char __pyx_k_maps_temp[] = "maps_temp";
static const char __pyx_k_minuslogp[] = "minuslogp";
static const char __pyx_k_pathos_mp[] = "pathos_mp";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_solve_ivp[] = "solve_ivp";
static const char __pyx_k_transpose[] = "transpose";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_block_diag[] = "block_diag";
static const char __pyx_k_covariance[] = "covariance";
static const char __pyx_k_det_method[] = "det_method";
static const char __pyx_k_first_step[] = "first_step";
static const char __pyx_k_infer_mcmc[] = "infer_mcmc";
static const char __pyx_k_init_flags[] = "init_flags";
static const char __pyx_k_init_fltrs[] = "init_fltrs";
static const char __pyx_k_init_guess[] = "init_guess";
static const char __pyx_k_latent_cov[] = "_latent_cov";
static const char __pyx_k_model_spec[] = "model_spec";
static const char __pyx_k_nprocesses[] = "nprocesses";
static const char __pyx_k_param_keys[] = "param_keys";
static const char __pyx_k_parameters[] = "parameters";
static const char __pyx_k_prior_dict[] = "prior_dict";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_queue_size[] = "queue_size";
static const char __pyx_k_run_nested[] = "run_nested";
static const char __pyx_k_set_params[] = "set_params";
static const char __pyx_k_walker_pos[] = "walker_pos";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_concatenate[] = "concatenate";
static const char __pyx_k_flat_params[] = "flat_params";
static const char __pyx_k_global_atol[] = "global_atol";
static const char __pyx_k_init_priors[] = "init_priors";
static const char __pyx_k_inter_steps[] = "inter_steps";
static const char __pyx_k_interpolate[] = "interpolate";
static const char __pyx_k_latent_mean[] = "_latent_mean";
static const char __pyx_k_logl_kwargs[] = "logl_kwargs";
static const char __pyx_k_matrix_rank[] = "matrix_rank";
static const char __pyx_k_maxNumSteps[] = "maxNumSteps";
static const char __pyx_k_n_effective[] = "n_effective";
static const char __pyx_k_param_pos_1[] = "param_pos_1";
static const char __pyx_k_param_pos_2[] = "param_pos_2";
static const char __pyx_k_params_dict[] = "params_dict";
static const char __pyx_k_permutedims[] = "permutedims";
static const char __pyx_k_process_obs[] = "process_obs";
static const char __pyx_k_scipy_stats[] = "scipy.stats";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_all_positive[] = "_all_positive";
static const char __pyx_k_check_length[] = "check_length";
static const char __pyx_k_dense_output[] = "dense_output";
static const char __pyx_k_enable_local[] = "enable_local";
static const char __pyx_k_get_log_prob[] = "get_log_prob";
static const char __pyx_k_infer_result[] = "infer_result";
static const char __pyx_k_latent_infer[] = "latent_infer";
static const char __pyx_k_logposterior[] = "_logposterior";
static const char __pyx_k_map_estimate[] = "map_estimate";
static const char __pyx_k_minimization[] = "minimization";
static const char __pyx_k_param_length[] = "param_length";
static const char __pyx_k_param_priors[] = "param_priors";
static const char __pyx_k_process_fltr[] = "process_fltr";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_resolution_1[] = "resolution_1";
static const char __pyx_k_resolution_2[] = "resolution_2";
static const char __pyx_k_scipy_linalg[] = "scipy.linalg";
static const char __pyx_k_split_spaces[] = "_split_spaces";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_tril_indices[] = "tril_indices";
static const char __pyx_k_triu_indices[] = "triu_indices";
static const char __pyx_k_NestedSampler[] = "NestedSampler";
static const char __pyx_k_age_dep_rates[] = "age_dep_rates";
static const char __pyx_k_approx_fprime[] = "approx_fprime";
static const char __pyx_k_cma_processes[] = "cma_processes";
static const char __pyx_k_contactMatrix[] = "contactMatrix";
static const char __pyx_k_enable_global[] = "enable_global";
static const char __pyx_k_log_posterior[] = "log_posterior";
static const char __pyx_k_loglikelihood[] = "_loglikelihood";
static const char __pyx_k_obs_flattened[] = "obs_flattened";
static const char __pyx_k_ptform_kwargs[] = "ptform_kwargs";
static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_rtol_lyapunov[] = "rtol_lyapunov";
static const char __pyx_k_set_det_model[] = "set_det_model";
static const char __pyx_k_tensorproduct[] = "tensorproduct";
static const char __pyx_k_ProcessingPool[] = "ProcessingPool";
static const char __pyx_k_SEAIRQ_testing[] = "SEAIRQ_testing";
static const char __pyx_k_cma_population[] = "cma_population";
static const char __pyx_k_latent_hessian[] = "latent_hessian";
static const char __pyx_k_lin_mode_inits[] = "_lin_mode_inits";
static const char __pyx_k_local_max_iter[] = "local_max_iter";
static const char __pyx_k_log_likelihood[] = "log_likelihood";
static const char __pyx_k_loglike_latent[] = "_loglike_latent";
static const char __pyx_k_make_det_model[] = "make_det_model";
static const char __pyx_k_print_progress[] = "print_progress";
static const char __pyx_k_scaled_guesses[] = "scaled_guesses";
static const char __pyx_k_scipy_optimize[] = "scipy.optimize";
static const char __pyx_k_smooth_penalty[] = "smooth_penalty";
static const char __pyx_k_EnsembleSampler[] = "EnsembleSampler";
static const char __pyx_k_FIM_locals_mean[] = "FIM.<locals>.mean";
static const char __pyx_k_RK2_integration[] = "RK2_integration";
static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
static const char __pyx_k_cma_random_seed[] = "cma_random_seed";
static const char __pyx_k_construct_inits[] = "_construct_inits";
static const char __pyx_k_contact_matrix0[] = "contact_matrix0";
static const char __pyx_k_disable_penalty[] = "disable_penalty";
static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
static const char __pyx_k_global_max_iter[] = "global_max_iter";
static const char __pyx_k_lyapunov_method[] = "lyapunov_method";
static const char __pyx_k_map_params_dict[] = "map_params_dict";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_scipy_integrate[] = "scipy.integrate";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_fill_params_dict[] = "fill_params_dict";
static const char __pyx_k_flat_guess_range[] = "flat_guess_range";
static const char __pyx_k_input_parameters[] = "input_parameters";
static const char __pyx_k_intervention_fun[] = "intervention_fun";
static const char __pyx_k_largest_real_eig[] = "largest_real_eig";
static const char __pyx_k_make_params_dict[] = "make_params_dict";
static const char __pyx_k_parse_model_spec[] = "parse_model_spec";
static const char __pyx_k_pyross_inference[] = "pyross.inference";
static const char __pyx_k_pyx_unpickle_SIR[] = "__pyx_unpickle_SIR";
static const char __pyx_k_pyx_unpickle_Spp[] = "__pyx_unpickle_Spp";
static const char __pyx_k_solve_triangular[] = "solve_triangular";
static const char __pyx_k_infer_to_minimize[] = "_infer_to_minimize";
static const char __pyx_k_interpolate_euler[] = "interpolate_euler";
static const char __pyx_k_latent_infer_mcmc[] = "latent_infer_mcmc";
static const char __pyx_k_measurement_error[] = "measurement_error";
static const char __pyx_k_param_guess_range[] = "param_guess_range";
static const char __pyx_k_parameter_mapping[] = "parameter_mapping";
static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
static const char __pyx_k_pyx_unpickle_SEIR[] = "__pyx_unpickle_SEIR";
static const char __pyx_k_pyx_unpickle_SppQ[] = "__pyx_unpickle_SppQ";
static const char __pyx_k_ravel_multi_index[] = "ravel_multi_index";
static const char __pyx_k_scipy_interpolate[] = "scipy.interpolate";
static const char __pyx_k_set_contactMatrix[] = "set_contactMatrix";
static const char __pyx_k_tensorcontraction[] = "tensorcontraction";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_convert_vec_to_mat[] = "convert_vec_to_mat";
static const char __pyx_k_is_scale_parameter[] = "is_scale_parameter";
static const char __pyx_k_make_interp_spline[] = "make_interp_spline";
static const char __pyx_k_partial_derivative[] = "partial_derivative";
static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
static const char __pyx_k_FIM_det_locals_mean[] = "FIM_det.<locals>.mean";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_Specify_a_generator[] = "Specify a generator";
static const char __pyx_k_control_params_dict[] = "control_params_dict";
static const char __pyx_k_logposterior_latent[] = "_logposterior_latent";
static const char __pyx_k_multivariate_normal[] = "multivariate_normal";
static const char __pyx_k_obtain_time_evol_op[] = "_obtain_time_evol_op";
static const char __pyx_k_process_latent_data[] = "process_latent_data";
static const char __pyx_k_pyross_utils_python[] = "pyross.utils_python";
static const char __pyx_k_pyx_unpickle_SEAIRQ[] = "__pyx_unpickle_SEAIRQ";
static const char __pyx_k_loglikelihood_latent[] = "_loglikelihood_latent";
static const char __pyx_k_obtain_full_mean_cov[] = "obtain_full_mean_cov";
static const char __pyx_k_pyross_contactMatrix[] = "pyross.contactMatrix";
static const char __pyx_k_pyross_deterministic[] = "pyross.deterministic";
static const char __pyx_k_pyross_inference_pyx[] = "pyross/inference.pyx";
static const char __pyx_k_scaled_param_guesses[] = "scaled_param_guesses";
static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
static const char __pyx_k_unflatten_parameters[] = "unflatten_parameters";
static const char __pyx_k_FIM_locals_covariance[] = "FIM.<locals>.covariance";
static const char __pyx_k_MutableDenseNDimArray[] = "MutableDenseNDimArray";
static const char __pyx_k_build_SppQ_model_spec[] = "build_SppQ_model_spec";
static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
static const char __pyx_k_infer_nested_sampling[] = "infer_nested_sampling";
static const char __pyx_k_integrate_locals_rhs0[] = "integrate.<locals>.rhs0";
static const char __pyx_k_mean_cov_for_lat_traj[] = "_mean_cov_for_lat_traj";
static const char __pyx_k_obtain_time_evol_op_2[] = "_obtain_time_evol_op_2";
static const char __pyx_k_parse_init_prior_dict[] = "parse_init_prior_dict";
static const char __pyx_k_pyx_unpickle_SIR_type[] = "__pyx_unpickle_SIR_type";
static const char __pyx_k_pyx_unpickle_SppQ_old[] = "__pyx_unpickle_SppQ_old";
static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
static const char __pyx_k_constant_contactMatrix[] = "constant_contactMatrix";
static const char __pyx_k_latent_FIM_locals_mean[] = "latent_FIM.<locals>.mean";
static const char __pyx_k_parse_param_prior_dict[] = "parse_param_prior_dict";
static const char __pyx_k_pathos_multiprocessing[] = "pathos.multiprocessing";
static const char __pyx_k_process_contact_matrix[] = "_process_contact_matrix";
static const char __pyx_k_pyx_unpickle_SppSparse[] = "__pyx_unpickle_SppSparse";
static const char __pyx_k_solve_lyapunov_type_eq[] = "_solve_lyapunov_type_eq";
static const char __pyx_k_time_dep_param_mapping[] = "time_dep_param_mapping";
static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
static const char __pyx_k_SIR_type_infer_line_304[] = "SIR_type.infer (line 304)";
static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
static const char __pyx_k_update_model_parameters[] = "update_model_parameters";
static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
static const char __pyx_k_contact_matrix_threshold[] = "contact_matrix_threshold";
static const char __pyx_k_hessian_locals_minuslogp[] = "hessian.<locals>.minuslogp";
static const char __pyx_k_latent_infer_to_minimize[] = "_latent_infer_to_minimize";
static const char __pyx_k_return_additional_params[] = "return_additional_params";
static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
static const char __pyx_k_forward_euler_integration[] = "forward_euler_integration";
static const char __pyx_k_hessian_finite_difference[] = "hessian_finite_difference";
static const char __pyx_k_infer_mcmc_process_result[] = "infer_mcmc_process_result";
static const char __pyx_k_mean_cov_for_lat_endpoint[] = "_mean_cov_for_lat_endpoint";
static const char __pyx_k_latent_FIM_det_locals_mean[] = "latent_FIM_det.<locals>.mean";
static const char __pyx_k_robustness_locals_bilinear[] = "robustness.<locals>.bilinear";
static const char __pyx_k_full_time_dep_param_mapping[] = "full_time_dep_param_mapping";
static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static const char __pyx_k_pyx_unpickle_SEAIRQ_testing[] = "__pyx_unpickle_SEAIRQ_testing";
static const char __pyx_k_SIR_type_infer_mcmc_line_649[] = "SIR_type.infer_mcmc (line 649)";
static const char __pyx_k_intervention_custom_temporal[] = "intervention_custom_temporal";
static const char __pyx_k_latent_FIM_locals_covariance[] = "latent_FIM.<locals>.covariance";
static const char __pyx_k_latent_infer_nested_sampling[] = "latent_infer_nested_sampling";
static const char __pyx_k_SIR_type_robustness_line_1216[] = "SIR_type.robustness (line 1216)";
static const char __pyx_k_find_fastest_growing_lin_mode[] = "find_fastest_growing_lin_mode";
static const char __pyx_k_set_time_dep_model_parameters[] = "set_time_dep_model_parameters";
static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
static const char __pyx_k_not_implemented_Choose_between[] = "{} not implemented. Choose between LSODA, RK45, RK2 and euler";
static const char __pyx_k_obtain_time_evol_op_locals_rhs[] = "_obtain_time_evol_op.<locals>.rhs";
static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
static const char __pyx_k_Compute_the_maximum_a_posterior[] = "\n        Compute the maximum a-posteriori (MAP) estimate for all desired parameters, including control parameters, for an SIR type model\n        with fully observed classes. If `generator` is specified, the lockdown is modelled by scaling the contact matrices for contact at work,\n        school, and other (but not home). This function infers the scaling parameters (can be age dependent) assuming that full data\n        on all classes is available (with latent variables, use `latent_infer`).\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        prior_dict: dict\n            A dictionary containing priors for parameters (can include both model and intervention parameters). See examples.\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space infere""nce. Default is false.\n        verbose: bool, optional\n            Set to True to see intermediate outputs from the optimizer.\n        ftol: double\n            Relative tolerance of logp\n        global_max_iter: int, optional\n            Number of global optimisations performed.\n        local_max_iter: int, optional\n            Number of local optimisation performed.\n        global_atol: float\n            The absolute tolerance for global optimisation.\n        enable_global: bool, optional\n            Set to True to enable global optimisation.\n        enable_local: bool, optional\n            Set to True to enable local optimisation.\n        cma_processes: int, optional\n            Number of parallel processes used for global optimisation.\n        cma_population: int, optional\n            The number of samples used in each step of the CMA algorithm.\n        cma_random_seed: int (between 0 and 2**32-1)\n            Random seed for the optimisation algorithms. By default it is generated from numpy.random.randint.\n\n        Returns\n        -------\n        output_dict: dict\n            Dictionary of MAP estimates, containing the following keys for users:\n\n            params_dict: dict\n                Dictionary for MAP estimates of the model parameters.\n            control_params_dict: dict\n                Dictionary for MAP estimates of the control parameters (if requested).\n            -logp: float\n                Value of -logp at MAP.\n        Note\n        ----\n        This function combines the functionality of `infer_parameters` and `infer_control`,\n        which will be deprecated.\n        To infer model parameters only, specify a fixed `contactMatrix` function.\n        To infer control parameters only, specify a `generator` and do not specify priors for model parameters.\n\n        Examples\n        --------\n        An example of prior_dict to set priors for alpha and beta, where alpha\n        is age dependent and we want to i""nfer its scale parameters rather than\n        each component individually. The prior distribution is assumed to be\n        log-normal with the specified mean and standard deviation.\n\n        >>> prior_dict = {\n                'alpha':{\n                    'mean': [0.5, 0.2],\n                    'infer_scale': True,\n                    'scale_factor_std': 1,\n                    'scale_factor_bounds': [0.1, 10],\n                    'prior_fun': 'truncnorm'\n                },\n                'beta':{\n                    'mean': 0.02,\n                    'std': 0.1,\n                    'bounds': [1e-4, 1],\n                    'prior_fun': 'lognorm'\n                }\n            }\n\n        ";
static const char __pyx_k_Conflicts_in_initial_conditions[] = "Conflicts in initial conditions";
static const char __pyx_k_Error_lyapunov_method_not_found[] = "Error: lyapunov method not found. Use set_lyapunov_method to change the method";
static const char __pyx_k_FIM_not_positive_definite_check[] = "FIM not positive definite - check for appropriate step-size `eps` in FIM computation and/or increase `inter_steps` for a more stable result";
static const char __pyx_k_Robustness_analysis_in_a_two_di[] = "\n        Robustness analysis in a two-dimensional slice of the parameter space, revealing neutral spaces as in https://doi.org/10.1073/pnas.1015814108.\n\n        Parameters\n        ----------\n        FIM: 2d numpy.array\n            Fisher Information matrix of a stochastic model\n        FIM_det: 2d numpy.array\n            Fisher information matrix of the corresponding deterministic model\n        infer_result: dict\n            Dictionary returned by `latent_infer`\n        param_pos_1: int\n            Position of 'parameter 1' in map_dict['flat_map'] for x-axis\n        param_pos_2: int\n            Position of 'parameter 2' in map_dict['flat_map'] for y-axis\n        range_1: float\n            Symmetric interval around parameter 1 for which robustness will be analysed. Absolute interval: 'parameter 1' +/- range_1\n        range_2: float\n            Symmetric interval around parameter 2 for which robustness will be analysed. Absolute interval: 'parameter 2' +/- range_2\n        resolution_1: int\n            Resolution of the meshgrid in x direction.\n        resolution_2: int\n            Resolution of the meshgrid in y direction. Default is resolution_2=resolution_1.\n        Returns\n        -------\n        ff: 2d numpy.array\n            shape=resolution_1 x resolution_2, meshgrid for x-axis\n        ss: 2d numpy.array\n            shape=resolution_1 x resolution_2, meshgrid for y-axis\n        Z_sto: 2d numpy.array\n            shape=resolution_1 x resolution_2, expected quadratic coefficient in the Taylor expansion of the likelihood of the stochastic model\n        Z_det: 2d numpy.array\n            shape=resolution_1 x resolution_2, expected quadratic coefficient in the Taylor expansion of the likelihood of the deterministic model\n\n        Examples\n        --------\n        >>> from matplotlib import pyplot as plt\n        >>> from matplotlib import cm\n        >>>\n        >>> # positions 0 and 1 of infer_result['flat_params'] correspond to a ""scale parameter for alpha, and beta, respectively.\n        >>> ff, ss, Z_sto, Z_det = estimator.robustness(FIM, FIM_det, map_dict, 0, 1, 0.5, 0.01, 20)\n        >>> cmap = plt.cm.PuBu_r\n        >>> levels=11\n        >>> colors='black'\n        >>>\n        >>> c = plt.contourf(ff, ss, Z_sto, cmap=cmap, levels=levels) # heat map for the stochastic coefficient\n        >>> plt.contour(ff, ss, Z_sto, colors='black', levels=levels, linewidths=0.25)\n        >>> plt.contour(ff, ss, Z_det, colors=colors, levels=levels) # contour plot for the deterministic model\n        >>> plt.plot(infer_result['flat_params'][0], infer_result['flat_params'][1], 'o',\n                    color=\"#A60628\", markersize=6) # the MAP estimate\n        >>> plt.colorbar(c)\n        >>> plt.xlabel(r'$\007lpha$ scale', fontsize=20, labelpad=10)\n        >>> plt.ylabel(r'$\010eta$', fontsize=20, labelpad=10)\n        >>> plt.show()\n        ";
static const char __pyx_k_SIR_type_latent_infer_line_1712[] = "SIR_type.latent_infer (line 1712)";
static const char __pyx_k_SIR_type_latent_infer_mcmc_line[] = "SIR_type.latent_infer_mcmc (line 2181)";
static const char __pyx_k_Sample_the_posterior_distributi[] = "\n        Sample the posterior distribution of the epidemiological parameters using ensemble MCMC.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        prior_dict: dict\n            A dictionary containing priors for parameters (can include both model and intervention parameters). See examples.\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        verbose: bool, optional\n            Set to True to see a progress bar for the sample generation. Default is False.\n        sampler: emcee.EnsembleSampler, optional\n            Set to instance of the sampler (as returned by this function) to continue running the MCMC chains.\n            Default is None (i.e. run a new chain).\n        nwalkers:int, optional\n    ""        The number of chains in the ensemble (should be at least 2*dim). Default is 2*dim.\n        walker_pos: np.array, optional\n            The initial position of the walkers. If not specified, it samples random positions from the prior.\n        nsamples:int, optional\n            The number of samples per walker. Default is 1000.\n        nprocesses: int, optional\n            The number of processes used to compute the likelihood for the walkers, needs `pathos`. Default is\n            the number of cpu cores if `pathos` is available, otherwise 1.\n\n        Returns\n        -------\n        sampler: emcee.EnsembleSampler\n            This function returns the interal state of the sampler. To look at the chain of the internal flattened paramters,\n            run `sampler.get_chain()`. Use this to judge whether the chain has sufficiently converged. Either rerun\n            `mcmc_inference(..., sampler=sampler)` to continue the chain or `mcmc_inference_process_result(...)` to process\n            the result.\n\n        Examples\n        --------\n        For the structure of `prior_dict`, see the documentation of `infer`. To start sampling the posterior,\n        run for example\n\n        >>> sampler = estimator.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, verbose=True)\n\n        To judge the convergence of this chain, we can look at the trace plot of all the chains (for a moderate number of\n        dimensions `dim`)\n\n        >>> fig, axes = plt.subplots(dim, sharex=True)\n        >>> samples = sampler.get_chain()\n        >>> for i in range(dim):\n                ax = axes[i]\n                ax.plot(samples[:, :, i], \"k\", alpha=0.3)\n                ax.set_xlim(0, len(samples))\n        >>> axes[-1].set_xlabel(\"step number\");\n\n        For more detailed convergence metrics, see the documentation of `emcee`. To continue running this chain, we can\n        call this function again with the sampler as argument\n\n        >>> sampler = ""estimator.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, verbose=True, sampler=sampler)\n\n        This procudes 1000 additional samples in each chain. To process the results, call `infer_mcmc_process_result`.\n        ";
static const char __pyx_k_is_not_a_parameter_of_the_model[] = "{} is not a parameter of the model";
static const char __pyx_k_latent_hessian_locals_minuslogp[] = "latent_hessian.<locals>.minuslogp";
static const char __pyx_k_nested_sampling_prior_transform[] = "_nested_sampling_prior_transform";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static const char __pyx_k_Incompatible_checksums_s_vs_0x06[] = "Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x16[] = "Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x29[] = "Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x5c[] = "Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xa4[] = "Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xdc[] = "Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xe4[] = "Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))";
static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static const char __pyx_k_Key_error_or_unspecified_generat[] = "Key error or unspecified generator";
static const char __pyx_k_MCMC_sampling_needs_optional_dep[] = "MCMC sampling needs optional dependency `emcee` which was not found.";
static const char __pyx_k_Nested_sampling_needs_optional_d[] = "Nested sampling needs optional dependency `dynesty` which was not found.";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_Number_of_steps_must_be_at_least[] = "Number of steps must be at least 2";
static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
static const char __pyx_k_Please_Implement_compute_jacobia[] = "Please Implement compute_jacobian_and_b_matrix in subclass";
static const char __pyx_k_Please_Implement_make_params_dic[] = "Please Implement make_params_dict in subclass";
static const char __pyx_k_Please_Implement_set_det_model_i[] = "Please Implement set_det_model in subclass";
static const char __pyx_k_SIR_type__estimate_cond_cov_loca[] = "SIR_type._estimate_cond_cov.<locals>.rhs";
static const char __pyx_k_Specify_either_a_fixed_contactMa[] = "Specify either a fixed contactMatrix or a generator";
static const char __pyx_k_Specify_either_parameter_mapping[] = "Specify either parameter_mapping or time_dep_param_mapping";
static const char __pyx_k_The_Python_package_pathos_is_nee[] = "The Python package `pathos` is needed for multiprocessing.";
static const char __pyx_k_The_parameters_passed_do_not_con[] = "The parameters passed do not contain certain keys. The keys are {}";
static const char __pyx_k_The_parameters_returned_by_param[] = "The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}";
static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
static const char __pyx_k_eps_vector_used_for_differentiat[] = "eps-vector used for differentiation: ";
static const char __pyx_k_epsilon_used_for_differentiation[] = "epsilon used for differentiation: ";
static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
static const char __pyx_k_infer_nested_sampling_process_re[] = "infer_nested_sampling_process_result";
static const char __pyx_k_latent_infer_mcmc_process_result[] = "latent_infer_mcmc_process_result";
static const char __pyx_k_latent_infer_nested_sampling_pro[] = "latent_infer_nested_sampling_process_result";
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_not_implemented_Choose_between_2[] = "{} not implemented. Choose between LSODA and RK45";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_obtain_full_mean_cov_tangent_spa[] = "obtain_full_mean_cov_tangent_space";
static const char __pyx_k_solve_symmetric_close_to_singula[] = "solve_symmetric_close_to_singular";
static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
static const char __pyx_k_x0_not_consistent_with_obs0_Usin[] = "x0 not consistent with obs0. Using x0 in the calculation of logp...";
static const char __pyx_k_Compute_the_maximum_a_posterior_2[] = "\n        Compute the maximum a-posteriori (MAP) estimate for the initial conditions and all desired parameters, including control parameters,\n        for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            Total time of the trajectory\n        param_priors: dict\n            A dictionary that specifies priors for parameters (including control parameters, if desired). See `infer` for further explanations.\n        init_priors: dict\n            A dictionary for priors for initial conditions. See below for examples\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is false"".\n        verbose: bool, optional\n            Set to True to see intermediate outputs from the optimizer.\n        ftol: double\n            Relative tolerance of logp\n        global_max_iter: int, optional\n            Number of global optimisations performed.\n        local_max_iter: int, optional\n            Number of local optimisation performed.\n        global_atol: float\n            The absolute tolerance for global minimisation.\n        enable_global: bool, optional\n            Set to True to enable global optimisation.\n        enable_local: bool, optional\n            Set to True to enable local optimisation.\n        cma_processes: int, optional\n            Number of parallel processes used for global optimisation.\n        cma_population: int, optional\n            The number of samples used in each step of the CMA algorithm.\n        cma_random_seed: int (between 0 and 2**32-1)\n            Random seed for the optimisation algorithms. By default it is generated from numpy.random.randint.\n\n        Returns\n        -------\n        output_dict: dict\n            A dictionary containing the following keys for users:\n\n            x0: np.array\n                MAP estimates for the initial conditions\n            params_dict: dict\n                dictionary for MAP estimates for model parameters\n            control_params_dict: dict\n                dictionary for MAP estimates for control parameters (if requested)\n            -logp: float\n                Value of -logp at MAP.\n\n        Note\n        ----\n        This function combines the functionality of `latent_infer_parameters` and `latent_infer_control`,\n        which will be deprecated.\n        To infer model parameters only, specify a fixed `contactMatrix` function.\n        To infer control parameters only, specify a `generator` and do not specify priors for model parameters.\n\n        Examples\n        --------\n        Here we list three examples, one for inferring all initial"" conditions\n        along the fastest growing linear mode, one for inferring the initial\n        conditions individually and a mixed one.\n\n        First, suppose we only observe Is out of (S, Ia, Is) and we wish to\n        infer all compartmental values of S and Ia independently. For two age\n        groups with population [2500, 7500],\n\n        >>> init_priors = {\n                'independent':{\n                    'fltr': [True, True, True, True, False, False],\n                    'mean': [2400, 7400, 50, 50],\n                    'std': [200, 200, 200, 200],\n                    'bounds': [[2000, 2500], [7000, 7500], [0, 400], [0, 400]]\n                }\n            }\n\n        In the 'fltr' entry, we need a boolean array indicating which components\n        of the full x0 = [S0[0], S0[1], Ia0[0], Ia0[1], Is0[0], Ia0[1]] array we are inferring.\n        By setting fltr = [True, True, True, True, False, False], the inference algorithm\n        will know that we are inferring all components of S0 and Ia0 but not Is0.\n        Similar to inference for parameter values, we also assume a log-normal\n        distribution for the priors for the initial conditions.\n\n        Next, if we are happy to assume that all our initial conditions lie\n        along the fastest growing linear mode and we will only infer the\n        coefficient of the mode, the init_priors dict would be,\n\n        >>> init_priors = {\n                'lin_mode_coeff':{\n                    'fltr': [True, True, True, True, False, False],\n                    'mean': 100,\n                    'std': 100,\n                    'bounds': [1, 1000]\n                }\n            }\n\n        Note that the 'fltr' entry is still the same as before because we still\n        only want to infer S and Ia, and the initial conditions for Is is fixed\n        by the observation.\n\n        Finally, if we want to do a mixture of both (useful when some compartments\n        have aligned with the fa""stest growing mode but others haven't), we need\n        to set the init_priors to be,\n\n        >>> init_priors = {\n                'lin_mode_coeff': {\n                    'fltr': [True, True, False, False, False, False],\n                    'mean': 100,\n                    'std': 100,\n                    'bounds': [1, 1000]\n                },\n                'independent':{\n                    'fltr': [False, False, True, True, False, False],\n                    'mean': [50, 50],\n                    'std': [200, 200],\n                    'bounds': [0, 400], [0, 400]\n                }\n            }\n        ";
static const char __pyx_k_Sample_the_posterior_distributi_2[] = " Sample the posterior distribution of the initial conditions and all desired parameters, including control parameters, using\n        ensemble MCMC. This requires the optional dependency `emcee`.\n\n        Parameters\n        ----------\n        obs: 2d numpy.array\n            The observed trajectories with reduced number of variables\n            (number of data points, (age groups * observed model classes))\n        fltr: 2d numpy.array\n            A matrix of shape (no. observed variables, no. total variables),\n            such that obs_{ti} = fltr_{ij} * X_{tj}\n        Tf: float\n            Total time of the trajectory\n        contactMatrix: callable\n            A function that returns the contact matrix at time t (input).\n        param_priors: dict\n            A dictionary for priors for the model parameters.\n            See `latent_infer_parameters` for further explanations.\n        init_priors: dict\n            A dictionary for priors for the initial conditions.\n            See `latent_infer_parameters` for further explanations.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        verbose: bool, optional\n            Set to True to see a progress bar for the sample generation. Default is False.\n        sampler: emcee.EnsembleSampler, optional\n            Set to instance of the sampler (as returned by this function) to continue running the MCMC chains.\n            Default is None (i.e. run a new chain).\n        nwalkers:int, optional\n            The number of chains in the ensemble (should be at least 2*dim). Default is 2*dim.\n        walker_pos: np.array, optional\n            The initial position of the walkers. If not specified, the function samples random positions from the prior.\n        nsamples:int, optional\n            The number of samples per walker. Default is 1000.\n        nprocesses: int, optional\n            The number of processes used to compute the likeliho""od for the walkers, needs `pathos` for values > 1.\n            Default is the number of cpu cores if `pathos` is available, otherwise 1.\n\n        Returns\n        -------\n        sampler: emcee.EnsembleSampler\n            This function returns the state of the sampler. To look at the chain of the internal flattened parameters,\n            run `sampler.get_chain()`. Use this to judge whether the chain has sufficiently converged. Either rerun\n            `latent_infer_mcmc(..., sampler=sampler)` to continue the chain or `latent_infer_mcmc_process_result(...)`\n            to process the result.\n\n        Examples\n        --------\n        For the structure of the model input parameters, in particular `param_priors, init_priors`, see the documentation\n        of `latent_infer`. To start sampling the posterior, run for example\n\n        >>> sampler = estimator.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,\n                                                  verbose=True)\n\n        To judge the convergence of this chain, we can look at the trace plot of all the chains (for a moderate number of\n        dimensions `dim`)\n\n        >>> fig, axes = plt.subplots(dim, sharex=True)\n        >>> samples = sampler.get_chain()\n        >>> for i in range(dim):\n                ax = axes[i]\n                ax.plot(samples[:, :, i], \"k\", alpha=0.3)\n                ax.set_xlim(0, len(samples))\n        >>> axes[-1].set_xlabel(\"step number\");\n\n        For more detailed convergence metrics, see the documentation of `emcee`. To continue running this chain, we can\n        call this function again with the sampler as argument\n\n        >>> sampler = estimator.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,\n                                                  verbose=True, sampler=sampler)\n\n        This procudes 1000 additional samples in each chain. To process the results, call\n     ""   `pyross.inference.latent_infer_mcmc_process_result`.\n        ";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static const char __pyx_k_Incompatible_checksums_s_vs_0x16_2[] = "Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))";
static const char __pyx_k_The_parameters_passed_do_not_con_2[] = "The parameters passed do not contain certain keys.                             The keys are {}";
static PyObject *__pyx_n_u_A;
static PyObject *__pyx_n_s_ASCII;
static PyObject *__pyx_n_s_Array;
static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
static PyObject *__pyx_kp_u_Compute_the_maximum_a_posterior;
static PyObject *__pyx_kp_u_Compute_the_maximum_a_posterior_2;
static PyObject *__pyx_kp_u_Conflicts_in_initial_conditions;
static PyObject *__pyx_n_s_DTYPE;
static PyObject *__pyx_n_u_E;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
static PyObject *__pyx_n_s_EnsembleSampler;
static PyObject *__pyx_kp_u_Error_lyapunov_method_not_found;
static PyObject *__pyx_n_s_FIM;
static PyObject *__pyx_n_s_FIM_det;
static PyObject *__pyx_n_s_FIM_det_locals_mean;
static PyObject *__pyx_n_s_FIM_locals_covariance;
static PyObject *__pyx_n_s_FIM_locals_mean;
static PyObject *__pyx_kp_u_FIM_not_positive_definite_check;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_u_Ia;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x06;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x16;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x16_2;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x29;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x5c;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xa4;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xdc;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xe4;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
static PyObject *__pyx_n_s_Inf;
static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
static PyObject *__pyx_n_s_Inverse;
static PyObject *__pyx_n_u_Is;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_kp_u_Key_error_or_unspecified_generat;
static PyObject *__pyx_n_u_LSODA;
static PyObject *__pyx_n_s_M;
static PyObject *__pyx_n_s_M0;
static PyObject *__pyx_kp_u_MCMC_sampling_needs_optional_dep;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
static PyObject *__pyx_kp_s_MemoryView_of_r_object;
static PyObject *__pyx_n_s_MutableDenseNDimArray;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_s_NestedSampler;
static PyObject *__pyx_kp_u_Nested_sampling_needs_optional_d;
static PyObject *__pyx_n_s_Nf;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_u_Number_of_steps_must_be_at_least;
static PyObject *__pyx_n_b_O;
static PyObject *__pyx_n_s_Omega;
static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_kp_u_Please_Implement_compute_jacobia;
static PyObject *__pyx_kp_u_Please_Implement_make_params_dic;
static PyObject *__pyx_kp_u_Please_Implement_set_det_model_i;
static PyObject *__pyx_n_s_Prior;
static PyObject *__pyx_n_s_ProcessingPool;
static PyObject *__pyx_n_u_Q;
static PyObject *__pyx_n_u_R;
static PyObject *__pyx_n_u_RK2;
static PyObject *__pyx_n_s_RK2_integration;
static PyObject *__pyx_n_u_RK45;
static PyObject *__pyx_kp_u_Robustness_analysis_in_a_two_di;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_u_S;
static PyObject *__pyx_n_s_SEAIRQ;
static PyObject *__pyx_n_s_SEAIRQ_testing;
static PyObject *__pyx_n_s_SEIR;
static PyObject *__pyx_n_s_SIR;
static PyObject *__pyx_n_s_SIR_type;
static PyObject *__pyx_n_s_SIR_type__estimate_cond_cov_loca;
static PyObject *__pyx_kp_u_SIR_type_infer_line_304;
static PyObject *__pyx_kp_u_SIR_type_infer_mcmc_line_649;
static PyObject *__pyx_kp_u_SIR_type_latent_infer_line_1712;
static PyObject *__pyx_kp_u_SIR_type_latent_infer_mcmc_line;
static PyObject *__pyx_kp_u_SIR_type_robustness_line_1216;
static PyObject *__pyx_kp_u_Sample_the_posterior_distributi;
static PyObject *__pyx_kp_u_Sample_the_posterior_distributi_2;
static PyObject *__pyx_kp_u_Specify_a_generator;
static PyObject *__pyx_kp_u_Specify_either_a_fixed_contactMa;
static PyObject *__pyx_kp_u_Specify_either_parameter_mapping;
static PyObject *__pyx_n_s_Spp;
static PyObject *__pyx_n_s_SppQ;
static PyObject *__pyx_n_s_SppQ_old;
static PyObject *__pyx_n_s_SppSparse;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_Tf;
static PyObject *__pyx_n_u_Tf;
static PyObject *__pyx_kp_u_The_Python_package_pathos_is_nee;
static PyObject *__pyx_kp_u_The_parameters_passed_do_not_con;
static PyObject *__pyx_kp_u_The_parameters_passed_do_not_con_2;
static PyObject *__pyx_kp_u_The_parameters_returned_by_param;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_U_mat;
static PyObject *__pyx_n_s_U_vec;
static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_View_MemoryView;
static PyObject *__pyx_n_s__75;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_add_live;
static PyObject *__pyx_n_s_age_dep_rates;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_all_positive;
static PyObject *__pyx_n_s_allclose;
static PyObject *__pyx_n_s_allocate_buffer;
static PyObject *__pyx_n_u_alpha;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_approx_fprime;
static PyObject *__pyx_n_s_args_dict;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_u_ars;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_astype;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_u_beta;
static PyObject *__pyx_n_s_bilinear;
static PyObject *__pyx_n_s_block_diag;
static PyObject *__pyx_n_u_bool;
static PyObject *__pyx_n_s_bounds;
static PyObject *__pyx_n_u_bounds;
static PyObject *__pyx_n_s_build_SppQ_model_spec;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_u_c;
static PyObject *__pyx_n_u_central;
static PyObject *__pyx_n_s_check_length;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_cma_population;
static PyObject *__pyx_n_s_cma_processes;
static PyObject *__pyx_n_s_cma_random_seed;
static PyObject *__pyx_n_s_cma_stds;
static PyObject *__pyx_n_s_compress;
static PyObject *__pyx_n_s_concatenate;
static PyObject *__pyx_n_s_constant_contactMatrix;
static PyObject *__pyx_n_s_construct_inits;
static PyObject *__pyx_n_s_contactMatrix;
static PyObject *__pyx_n_s_contact_matrix0;
static PyObject *__pyx_n_s_contact_matrix_threshold;
static PyObject *__pyx_kp_s_contiguous_and_direct;
static PyObject *__pyx_kp_s_contiguous_and_indirect;
static PyObject *__pyx_n_u_control_params_dict;
static PyObject *__pyx_n_s_convert_vec_to_mat;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_cov;
static PyObject *__pyx_n_s_cov_2;
static PyObject *__pyx_n_s_covariance;
static PyObject *__pyx_n_s_cpu_count;
static PyObject *__pyx_n_s_dUdt;
static PyObject *__pyx_n_s_dense_output;
static PyObject *__pyx_n_s_det;
static PyObject *__pyx_n_s_det_method;
static PyObject *__pyx_n_s_det_model;
static PyObject *__pyx_n_s_dev;
static PyObject *__pyx_n_s_diag;
static PyObject *__pyx_n_s_diagonal;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_dill;
static PyObject *__pyx_n_u_disable_penalty;
static PyObject *__pyx_n_s_discard;
static PyObject *__pyx_n_s_divide;
static PyObject *__pyx_n_s_dlogz;
static PyObject *__pyx_n_s_dot;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_dtype_is_object;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_dxdt;
static PyObject *__pyx_n_s_dynesty;
static PyObject *__pyx_n_s_eig;
static PyObject *__pyx_n_s_eigvalsh;
static PyObject *__pyx_n_s_emcee;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_enable_global;
static PyObject *__pyx_n_s_enable_local;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_eps;
static PyObject *__pyx_kp_u_eps_vector_used_for_differentiat;
static PyObject *__pyx_kp_u_epsilon_used_for_differentiation;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_u_euler;
static PyObject *__pyx_n_s_exp;
static PyObject *__pyx_n_s_eye;
static PyObject *__pyx_n_s_fd_method;
static PyObject *__pyx_n_s_fi;
static PyObject *__pyx_n_s_fill_params_dict;
static PyObject *__pyx_n_s_find_fastest_growing_lin_mode;
static PyObject *__pyx_n_s_first_step;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_flat;
static PyObject *__pyx_n_s_flat_guess_range;
static PyObject *__pyx_n_u_flat_guess_range;
static PyObject *__pyx_n_u_flat_map;
static PyObject *__pyx_n_u_flat_params;
static PyObject *__pyx_n_s_flatten;
static PyObject *__pyx_n_s_float;
static PyObject *__pyx_n_u_float;
static PyObject *__pyx_n_s_fltr;
static PyObject *__pyx_n_u_fltr;
static PyObject *__pyx_n_s_fltr0;
static PyObject *__pyx_n_s_fltrs;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fortran;
static PyObject *__pyx_n_u_fortran;
static PyObject *__pyx_n_s_forward_euler_integration;
static PyObject *__pyx_n_u_fsa;
static PyObject *__pyx_n_s_ftol;
static PyObject *__pyx_n_s_full;
static PyObject *__pyx_n_s_full_time_dep_param_mapping;
static PyObject *__pyx_n_u_gA;
static PyObject *__pyx_n_u_gE;
static PyObject *__pyx_n_u_gIa;
static PyObject *__pyx_n_u_gIs;
static PyObject *__pyx_n_s_generator;
static PyObject *__pyx_n_u_generator;
static PyObject *__pyx_n_s_get_chain;
static PyObject *__pyx_n_s_get_log_prob;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_global_atol;
static PyObject *__pyx_n_s_global_max_iter;
static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
static PyObject *__pyx_n_s_grad;
static PyObject *__pyx_n_s_gradient;
static PyObject *__pyx_n_s_hashlib;
static PyObject *__pyx_n_s_hessian;
static PyObject *__pyx_n_s_hessian_finite_difference;
static PyObject *__pyx_n_s_hessian_locals_minuslogp;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_identity;
static PyObject *__pyx_n_s_imatmul;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_infer;
static PyObject *__pyx_n_s_infer_mcmc;
static PyObject *__pyx_n_s_infer_mcmc_process_result;
static PyObject *__pyx_n_s_infer_nested_sampling;
static PyObject *__pyx_n_s_infer_nested_sampling_process_re;
static PyObject *__pyx_n_s_infer_result;
static PyObject *__pyx_n_s_infer_to_minimize;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init_flags;
static PyObject *__pyx_n_u_init_flags;
static PyObject *__pyx_n_s_init_fltrs;
static PyObject *__pyx_n_u_init_fltrs;
static PyObject *__pyx_n_s_init_guess;
static PyObject *__pyx_n_s_init_priors;
static PyObject *__pyx_n_s_input_parameters;
static PyObject *__pyx_n_s_integrate;
static PyObject *__pyx_n_s_integrate_locals_rhs0;
static PyObject *__pyx_n_s_inter_steps;
static PyObject *__pyx_n_u_inter_steps;
static PyObject *__pyx_n_s_interp1d;
static PyObject *__pyx_n_s_interpolate;
static PyObject *__pyx_n_s_interpolate_euler;
static PyObject *__pyx_n_s_intervention_custom_temporal;
static PyObject *__pyx_n_s_intervention_fun;
static PyObject *__pyx_n_u_intervention_fun;
static PyObject *__pyx_n_s_intp;
static PyObject *__pyx_n_s_inv;
static PyObject *__pyx_n_s_invert;
static PyObject *__pyx_kp_u_is_not_a_parameter_of_the_model;
static PyObject *__pyx_n_s_is_scale_parameter;
static PyObject *__pyx_n_u_is_scale_parameter;
static PyObject *__pyx_n_s_isclose;
static PyObject *__pyx_n_s_isscalar;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_u_kapE;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_u_keys;
static PyObject *__pyx_n_s_kind;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_largest_real_eig;
static PyObject *__pyx_n_s_latent_FIM_det_locals_mean;
static PyObject *__pyx_n_s_latent_FIM_locals_covariance;
static PyObject *__pyx_n_s_latent_FIM_locals_mean;
static PyObject *__pyx_n_s_latent_cov;
static PyObject *__pyx_n_s_latent_hessian;
static PyObject *__pyx_n_s_latent_hessian_locals_minuslogp;
static PyObject *__pyx_n_s_latent_infer;
static PyObject *__pyx_n_s_latent_infer_mcmc;
static PyObject *__pyx_n_s_latent_infer_mcmc_process_result;
static PyObject *__pyx_n_s_latent_infer_nested_sampling;
static PyObject *__pyx_n_s_latent_infer_nested_sampling_pro;
static PyObject *__pyx_n_s_latent_infer_to_minimize;
static PyObject *__pyx_n_s_latent_mean;
static PyObject *__pyx_n_s_lin_mode_inits;
static PyObject *__pyx_n_s_linalg;
static PyObject *__pyx_n_u_linear;
static PyObject *__pyx_n_s_linspace;
static PyObject *__pyx_n_s_local_max_iter;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_u_log_likelihood;
static PyObject *__pyx_n_u_log_posterior;
static PyObject *__pyx_n_u_log_prior;
static PyObject *__pyx_n_s_logl;
static PyObject *__pyx_n_s_logl_kwargs;
static PyObject *__pyx_n_s_loglike;
static PyObject *__pyx_n_s_loglike_latent;
static PyObject *__pyx_n_s_loglikelihood;
static PyObject *__pyx_n_s_loglikelihood_latent;
static PyObject *__pyx_n_s_lognorm;
static PyObject *__pyx_n_s_logpdf;
static PyObject *__pyx_n_s_logposterior;
static PyObject *__pyx_n_s_logposterior_latent;
static PyObject *__pyx_n_s_logwt;
static PyObject *__pyx_n_s_logz;
static PyObject *__pyx_n_s_lyapunov_method;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_det_model;
static PyObject *__pyx_n_s_make_interp_spline;
static PyObject *__pyx_n_s_make_params_dict;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_u_map_dict;
static PyObject *__pyx_n_s_map_estimate;
static PyObject *__pyx_n_u_map_params_dict;
static PyObject *__pyx_n_u_map_x0;
static PyObject *__pyx_n_s_maps_temp;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_s_matmul;
static PyObject *__pyx_n_s_matrix_rank;
static PyObject *__pyx_n_s_maxNumSteps;
static PyObject *__pyx_n_s_max_step;
static PyObject *__pyx_n_s_maxcall;
static PyObject *__pyx_n_s_maxiter;
static PyObject *__pyx_n_s_mean;
static PyObject *__pyx_n_s_mean_2;
static PyObject *__pyx_n_s_mean_cov_for_lat_endpoint;
static PyObject *__pyx_n_s_mean_cov_for_lat_traj;
static PyObject *__pyx_n_s_measurement_error;
static PyObject *__pyx_n_s_memview;
static PyObject *__pyx_n_s_meshgrid;
static PyObject *__pyx_n_s_method;
static PyObject *__pyx_n_s_minimization;
static PyObject *__pyx_n_s_minimize;
static PyObject *__pyx_n_s_minimum;
static PyObject *__pyx_n_s_minuslogp;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_model_spec;
static PyObject *__pyx_n_s_multiply;
static PyObject *__pyx_n_s_multivariate_normal;
static PyObject *__pyx_n_s_nClass;
static PyObject *__pyx_n_s_n_effective;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_nested_sampling_prior_transform;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_norm;
static PyObject *__pyx_kp_u_not_implemented_Choose_between;
static PyObject *__pyx_kp_u_not_implemented_Choose_between_2;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_nprocesses;
static PyObject *__pyx_n_s_nsamples;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_nwalkers;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_u_object;
static PyObject *__pyx_n_s_obs;
static PyObject *__pyx_n_u_obs;
static PyObject *__pyx_n_s_obs0;
static PyObject *__pyx_n_u_obs0;
static PyObject *__pyx_n_s_obs_flattened;
static PyObject *__pyx_n_s_obtain_full_mean_cov;
static PyObject *__pyx_n_s_obtain_full_mean_cov_tangent_spa;
static PyObject *__pyx_n_s_obtain_time_evol_op;
static PyObject *__pyx_n_s_obtain_time_evol_op_2;
static PyObject *__pyx_n_s_obtain_time_evol_op_locals_rhs;
static PyObject *__pyx_n_s_ord;
static PyObject *__pyx_n_s_pack;
static PyObject *__pyx_n_s_param_1;
static PyObject *__pyx_n_s_param_2;
static PyObject *__pyx_n_s_param_guess_range;
static PyObject *__pyx_n_u_param_guess_range;
static PyObject *__pyx_n_s_param_keys;
static PyObject *__pyx_n_u_param_keys;
static PyObject *__pyx_n_s_param_length;
static PyObject *__pyx_n_u_param_length;
static PyObject *__pyx_n_s_param_pos_1;
static PyObject *__pyx_n_s_param_pos_2;
static PyObject *__pyx_n_s_param_priors;
static PyObject *__pyx_n_s_parameter_mapping;
static PyObject *__pyx_n_s_parameters;
static PyObject *__pyx_n_s_params;
static PyObject *__pyx_n_u_params_dict;
static PyObject *__pyx_n_s_parse_init_prior_dict;
static PyObject *__pyx_n_s_parse_model_spec;
static PyObject *__pyx_n_s_parse_param_prior_dict;
static PyObject *__pyx_n_s_partial_derivative;
static PyObject *__pyx_n_s_pathos_mp;
static PyObject *__pyx_n_s_pathos_multiprocessing;
static PyObject *__pyx_n_s_permutedims;
static PyObject *__pyx_n_s_pi;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_point;
static PyObject *__pyx_n_s_pool;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_ppf;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_print_progress;
static PyObject *__pyx_n_s_prior;
static PyObject *__pyx_n_u_prior;
static PyObject *__pyx_n_s_prior_dict;
static PyObject *__pyx_n_s_process_contact_matrix;
static PyObject *__pyx_n_s_process_fltr;
static PyObject *__pyx_n_s_process_latent_data;
static PyObject *__pyx_n_s_process_obs;
static PyObject *__pyx_n_s_progress;
static PyObject *__pyx_n_s_ptform_kwargs;
static PyObject *__pyx_n_s_pyross;
static PyObject *__pyx_n_s_pyross_contactMatrix;
static PyObject *__pyx_n_s_pyross_deterministic;
static PyObject *__pyx_n_s_pyross_inference;
static PyObject *__pyx_kp_s_pyross_inference_pyx;
static PyObject *__pyx_n_s_pyross_utils_python;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_getbuffer;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Enum;
static PyObject *__pyx_n_s_pyx_unpickle_SEAIRQ;
static PyObject *__pyx_n_s_pyx_unpickle_SEAIRQ_testing;
static PyObject *__pyx_n_s_pyx_unpickle_SEIR;
static PyObject *__pyx_n_s_pyx_unpickle_SIR;
static PyObject *__pyx_n_s_pyx_unpickle_SIR_type;
static PyObject *__pyx_n_s_pyx_unpickle_Spp;
static PyObject *__pyx_n_s_pyx_unpickle_SppQ;
static PyObject *__pyx_n_s_pyx_unpickle_SppQ_old;
static PyObject *__pyx_n_s_pyx_unpickle_SppSparse;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_quad;
static PyObject *__pyx_n_s_queue_size;
static PyObject *__pyx_n_s_rand;
static PyObject *__pyx_n_s_random;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_range_1;
static PyObject *__pyx_n_s_range_2;
static PyObject *__pyx_n_s_ravel;
static PyObject *__pyx_n_s_ravel_multi_index;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_repeat;
static PyObject *__pyx_n_s_repeats;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_resolution_1;
static PyObject *__pyx_n_s_resolution_2;
static PyObject *__pyx_n_s_results;
static PyObject *__pyx_n_s_return_additional_params;
static PyObject *__pyx_n_s_rhs;
static PyObject *__pyx_n_s_rhs0;
static PyObject *__pyx_n_s_rhs0_2;
static PyObject *__pyx_n_s_rmatmul;
static PyObject *__pyx_n_s_robustness_locals_bilinear;
static PyObject *__pyx_n_s_rq;
static PyObject *__pyx_n_s_rtol;
static PyObject *__pyx_n_s_rtol_det;
static PyObject *__pyx_n_s_rtol_lyapunov;
static PyObject *__pyx_n_s_run_mcmc;
static PyObject *__pyx_n_s_run_nested;
static PyObject *__pyx_n_s_sampler;
static PyObject *__pyx_n_s_samples;
static PyObject *__pyx_n_s_scaled_guesses;
static PyObject *__pyx_n_u_scaled_guesses;
static PyObject *__pyx_n_s_scaled_param_guesses;
static PyObject *__pyx_n_u_scaled_param_guesses;
static PyObject *__pyx_n_s_scipy;
static PyObject *__pyx_n_s_scipy_integrate;
static PyObject *__pyx_n_s_scipy_interpolate;
static PyObject *__pyx_n_s_scipy_linalg;
static PyObject *__pyx_n_s_scipy_optimize;
static PyObject *__pyx_n_s_scipy_stats;
static PyObject *__pyx_n_s_set_contactMatrix;
static PyObject *__pyx_n_s_set_det_model;
static PyObject *__pyx_n_s_set_params;
static PyObject *__pyx_n_s_set_time_dep_model_parameters;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_sig;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_smooth_penalty;
static PyObject *__pyx_n_s_sol;
static PyObject *__pyx_n_s_solve;
static PyObject *__pyx_n_s_solve_ivp;
static PyObject *__pyx_n_s_solve_lyapunov_type_eq;
static PyObject *__pyx_n_s_solve_symmetric_close_to_singula;
static PyObject *__pyx_n_s_solve_triangular;
static PyObject *__pyx_n_s_spacing;
static PyObject *__pyx_n_s_sparse;
static PyObject *__pyx_n_s_split_spaces;
static PyObject *__pyx_n_s_sqrt;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_steps;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_kp_s_strided_and_direct;
static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
static PyObject *__pyx_kp_s_strided_and_indirect;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_struct;
static PyObject *__pyx_n_s_subtract;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_sympy;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_t1;
static PyObject *__pyx_n_s_t2;
static PyObject *__pyx_n_u_tA;
static PyObject *__pyx_n_u_tE;
static PyObject *__pyx_n_u_tIa;
static PyObject *__pyx_n_u_tIs;
static PyObject *__pyx_n_u_tS;
static PyObject *__pyx_n_s_t_eval;
static PyObject *__pyx_n_s_tangent;
static PyObject *__pyx_n_u_tangent;
static PyObject *__pyx_n_u_tau;
static PyObject *__pyx_n_s_tensorcontraction;
static PyObject *__pyx_n_s_tensorproduct;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_testRate;
static PyObject *__pyx_n_s_thin;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_time_dep_param_mapping;
static PyObject *__pyx_n_s_trace;
static PyObject *__pyx_n_s_transpose;
static PyObject *__pyx_n_s_tril_indices;
static PyObject *__pyx_n_s_triu_indices;
static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
static PyObject *__pyx_n_s_unflatten_parameters;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_unpack;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_update_model_parameters;
static PyObject *__pyx_n_s_utils;
static PyObject *__pyx_n_s_var;
static PyObject *__pyx_n_s_verbose;
static PyObject *__pyx_n_s_vstack;
static PyObject *__pyx_n_s_walker_pos;
static PyObject *__pyx_n_u_weight;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_u_x;
static PyObject *__pyx_n_s_x0;
static PyObject *__pyx_n_u_x0;
static PyObject *__pyx_kp_u_x0_not_consistent_with_obs0_Usin;
static PyObject *__pyx_n_s_xt;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_n_s_zip;
static int __pyx_pf_6pyross_9inference_8SIR_type___init__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_nClass, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_2infer_parameters(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4nested_sampling_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_6nested_sampling_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8mcmc_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10mcmc_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_12infer_control(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_generator, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_14_loglikelihood(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_keys, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_tangent, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_flat_guess_range, PyObject *__pyx_v_scaled_guesses, PyObject *__pyx_v_bounds, PyObject *__pyx_v_inter_steps, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_16_logposterior(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, PyObject *__pyx_v_prior, PyObject *__pyx_v_logl_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_18_infer_to_minimize(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_grad, PyObject *__pyx_v_logp_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_20infer(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_ftol, PyObject *__pyx_v_global_max_iter, PyObject *__pyx_v_local_max_iter, PyObject *__pyx_v_global_atol, PyObject *__pyx_v_enable_global, PyObject *__pyx_v_enable_local, PyObject *__pyx_v_cma_processes, PyObject *__pyx_v_cma_population, PyObject *__pyx_v_cma_random_seed); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_22_nested_sampling_prior_transform(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_prior); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_24infer_nested_sampling(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_26infer_nested_sampling_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_28infer_mcmc(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_30infer_mcmc_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_32_mean(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_x0, PyObject *__pyx_v_Tf, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_34_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_Tf, PyObject *__pyx_v_x0, PyObject *__pyx_v_inter_steps, PyObject *__pyx_v_tangent); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3FIM_mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3FIM_2covariance(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_36FIM(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_7FIM_det_mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_38FIM_det(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_eps, PyObject *__pyx_v_measurement_error, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_7hessian_minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_40hessian(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10robustness_bilinear(PyObject *__pyx_self, PyObject *__pyx_v_param_1, PyObject *__pyx_v_param_2, PyObject *__pyx_v_det); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_42robustness(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_FIM, PyObject *__pyx_v_FIM_det, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_param_pos_1, PyObject *__pyx_v_param_pos_2, PyObject *__pyx_v_range_1, PyObject *__pyx_v_range_2, PyObject *__pyx_v_resolution_1, PyObject *__pyx_v_resolution_2); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_44sensitivity(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_FIM); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_46sample_gaussian(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_map_estimate, PyObject *__pyx_v_cov, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_tangent); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_48evidence_laplace(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_50obtain_minus_log_p(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters, PyArrayObject *__pyx_v_x, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_tangent); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_52_all_positive(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_x0); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_54latent_infer_parameters(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_56nested_sampling_latent_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_58nested_sampling_latent_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_60mcmc_latent_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_62mcmc_latent_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_64latent_infer_control(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_generator, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_66_loglikelihood_latent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_grad, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_param_length, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_obs0, PyObject *__pyx_v_init_flags, PyObject *__pyx_v_init_fltrs, PyObject *__pyx_v_tangent, PyObject *__pyx_v_smooth_penalty, PyObject *__pyx_v_bounds, PyObject *__pyx_v_inter_steps, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_68_logposterior_latent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, PyObject *__pyx_v_prior, PyObject *__pyx_v_logl_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_70_latent_infer_to_minimize(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_grad, PyObject *__pyx_v_logp_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_72latent_infer(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_ftol, PyObject *__pyx_v_global_max_iter, PyObject *__pyx_v_local_max_iter, PyObject *__pyx_v_global_atol, PyObject *__pyx_v_enable_global, PyObject *__pyx_v_enable_local, PyObject *__pyx_v_cma_processes, PyObject *__pyx_v_cma_population, PyObject *__pyx_v_cma_random_seed); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_74latent_infer_nested_sampling(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_76latent_infer_nested_sampling_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_78latent_infer_mcmc(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_80latent_infer_mcmc_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_82_latent_mean(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_param_length, CYTHON_UNUSED PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_obs0, PyObject *__pyx_v_inter_steps, PyObject *__pyx_v_init_flags, PyObject *__pyx_v_init_fltrs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_84_latent_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_param_length, CYTHON_UNUSED PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_obs0, PyObject *__pyx_v_inter_steps, PyObject *__pyx_v_init_flags, PyObject *__pyx_v_init_fltrs, PyObject *__pyx_v_tangent); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_2covariance(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_86latent_FIM(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_14latent_FIM_det_mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_88latent_FIM_det(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_eps, PyObject *__pyx_v_measurement_error, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_14latent_hessian_minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_90latent_hessian(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_92sample_gaussian_latent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_map_estimate, PyObject *__pyx_v_cov, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_tangent); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_94latent_evidence_laplace(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_96minus_logp_red(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters, PyArrayObject *__pyx_v_x0, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_tangent); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_98sample_endpoints(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_tangent, CYTHON_UNUSED PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_100sample_trajs(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_tangent, CYTHON_UNUSED PyObject *__pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_102get_mean_inits(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_init_priors, PyArrayObject *__pyx_v_obs0, PyArrayObject *__pyx_v_fltr0); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_104find_fastest_growing_lin_mode(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, double __pyx_v_t); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_106set_lyapunov_method(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_108set_det_method(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_det_method, PyObject *__pyx_v_rtol); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_110set_det_model(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_112set_contact_matrix(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_contactMatrix); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_114make_params_dict(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_116fill_params_dict(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_keys, PyObject *__pyx_v_params, PyObject *__pyx_v_return_additional_params); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_118set_params(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_120_construct_inits(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_init_guess, PyObject *__pyx_v_flags, PyObject *__pyx_v_fltrs, PyObject *__pyx_v_obs0, PyObject *__pyx_v_fltr0); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_122_lin_mode_inits(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, double __pyx_v_coeff); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_124_mean_cov_for_lat_endpoint(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, __Pyx_memviewslice __pyx_v_obs_flattened, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_tangent, Py_ssize_t __pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_126_mean_cov_for_lat_traj(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_tangent, Py_ssize_t __pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_128_split_spaces(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_fltr, PyObject *__pyx_v_obs); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_18_estimate_cond_cov_rhs(PyObject *__pyx_self, PyObject *__pyx_v_t, PyObject *__pyx_v_sig); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_130obtain_full_mean_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, Py_ssize_t __pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_132interpolate_euler(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_134obtain_full_mean_cov_tangent_space(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, Py_ssize_t __pyx_v_inter_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_136_rhs0(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_xt); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_138_obtain_time_evol_op_2(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_rhs(PyObject *__pyx_self, PyObject *__pyx_v_t, PyObject *__pyx_v_U_vec); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_140_obtain_time_evol_op(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_142_solve_lyapunov_type_eq(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_rhs, PyObject *__pyx_v_M0, PyObject *__pyx_v_t1, PyObject *__pyx_v_t2, PyObject *__pyx_v_steps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_144convert_vec_to_mat(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_cov); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_146_process_contact_matrix(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_9integrate_rhs0(PyObject *__pyx_self, double __pyx_v_t, __Pyx_memviewslice __pyx_v_xt); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_148integrate(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_t1, double __pyx_v_t2, Py_ssize_t __pyx_v_steps, PyObject *__pyx_v_dense_output, PyObject *__pyx_v_maxNumSteps); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_6nClass___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1M___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5steps___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3dim___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8vec_size___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5Omega___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8rtol_det___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13rtol_lyapunov___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4beta___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3gIa___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3gIs___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3fsa___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3_xm___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5alpha___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_2fi___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_2CM___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8dsigmadt___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1J___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1B___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5J_mat___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5B_vec___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1U___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13flat_indices1___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13flat_indices2___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_12flat_indices___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4rows___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4cols___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10det_method___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_15lyapunov_method___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_16class_index_dict___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10param_keys___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_7_interp___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13contactMatrix___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_21param_mapping_enabled___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_150__reduce_cython__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_152__setstate_cython__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_3SIR___init__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3SIR_2set_det_model(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3SIR_4infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3SIR_6make_params_dict(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3SIR_9det_model___get__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3SIR_8__reduce_cython__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3SIR_10__setstate_cython__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_4SEIR___init__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_2infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_4set_params(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_6set_det_model(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_8make_params_dict(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_2gE___get__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_9det_model___get__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_10__reduce_cython__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SEIR_12__setstate_cython__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_6SEAIRQ___init__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_4set_det_model(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_6make_params_dict(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2gE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2gA___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2tE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2tA___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_3tIa___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_3tIs___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_9det_model___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_8__reduce_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_10__setstate_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_14SEAIRQ_testing___init__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_testRate, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_2infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_4set_params(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_6set_testRate(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_testRate); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_8make_det_model(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_10make_params_dict(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_2gE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_2gA___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_3ars___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_4kapE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_8testRate___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_9det_model___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_12__reduce_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_14__setstate_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_3Spp___init__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_2infection_indices(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_4set_params(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_6set_time_dep_model_parameters(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_tt); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_8set_det_model(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_10make_params_dict(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_14constant_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_12linear_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_15infection_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_12finres_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_13resource_list___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_16model_parameters___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_23model_parameters_length___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_10finres_pop___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_9det_model___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_10model_spec___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_10param_dict___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_16model_param_keys___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_17parameter_mapping___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_22time_dep_param_mapping___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_12__reduce_cython__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_3Spp_14__setstate_cython__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_4SppQ___init__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_parameters, PyObject *__pyx_v_testRate, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_2full_time_dep_param_mapping(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_input_parameters, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_4set_testRate(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_testRate); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_15full_model_spec___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_28input_time_dep_param_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_19input_param_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_8testRate___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_6__reduce_cython__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4SppQ_8__setstate_cython__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_8SppQ_old___init__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_parameters, PyObject *__pyx_v_testRate, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_2infection_indices(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_4set_params(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_6set_time_dep_model_parameters(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_tt); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_8set_testRate(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_testRate); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10set_det_model(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_12make_params_dict(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_14_all_positive(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x0); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_14constant_terms___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_12linear_terms___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_15infection_terms___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_8test_pos___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_9test_freq___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_7nClassU___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10nClassUwoN___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_16model_parameters___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_9det_model___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10model_spec___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10param_dict___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_16model_param_keys___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_17parameter_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_22time_dep_param_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_8testRate___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_16__reduce_cython__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_18__setstate_cython__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pyross_9inference_9SppSparse___init__(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_contact_matrix0, PyObject *__pyx_v_contact_matrix_threshold, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_9SppSparse_2__reduce_cython__(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_9SppSparse_4__setstate_cython__(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference___pyx_unpickle_SIR_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_2__pyx_unpickle_SIR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_4__pyx_unpickle_SEIR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_6__pyx_unpickle_SEAIRQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_8__pyx_unpickle_SEAIRQ_testing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_10__pyx_unpickle_Spp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_12__pyx_unpickle_SppQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_14__pyx_unpickle_SppQ_old(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pyross_9inference_16__pyx_unpickle_SppSparse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
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 */
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 */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
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 */
static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
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 */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
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 */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
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 */
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 */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
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 */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
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 */
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 */
static PyObject *__pyx_tp_new_6pyross_9inference_SIR_type(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SIR(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SEIR(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SEAIRQ(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SEAIRQ_testing(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_Spp(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SppQ(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SppQ_old(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference_SppSparse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct__FIM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_1_FIM_det(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_2_hessian(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_3_robustness(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_4_latent_FIM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_6_latent_hessian(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_9_integrate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static PyObject *__pyx_float_1_;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_0_25;
static PyObject *__pyx_float_1eneg_2;
static PyObject *__pyx_float_1eneg_3;
static PyObject *__pyx_float_1eneg_4;
static PyObject *__pyx_float_1eneg_5;
static PyObject *__pyx_float_1eneg_6;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_1000;
static PyObject *__pyx_int_100000;
static PyObject *__pyx_int_6898761;
static PyObject *__pyx_int_23253038;
static PyObject *__pyx_int_23519854;
static PyObject *__pyx_int_43267880;
static PyObject *__pyx_int_96728239;
static PyObject *__pyx_int_172004068;
static PyObject *__pyx_int_184977713;
static PyObject *__pyx_int_230868175;
static PyObject *__pyx_int_239616695;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_slice_;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__49;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__45;
static PyObject *__pyx_codeobj__77;
static PyObject *__pyx_codeobj__79;
static PyObject *__pyx_codeobj__81;
static PyObject *__pyx_codeobj__83;
static PyObject *__pyx_codeobj__85;
static PyObject *__pyx_codeobj__87;
static PyObject *__pyx_codeobj__89;
static PyObject *__pyx_codeobj__91;
static PyObject *__pyx_codeobj__93;
static PyObject *__pyx_codeobj__100;
/* Late includes */

/* "pyross/inference.pyx":73
 * 
 * 
 *     def __init__(self, parameters, nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov):             # <<<<<<<<<<<<<<
 *         self.Omega = Omega
 *         self.M = M
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_8SIR_type_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_8SIR_type_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_nClass = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_nClass,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nClass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 1); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 2); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 3); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 4); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 5); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 6); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 7); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 8); __PYX_ERR(0, 73, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, 9); __PYX_ERR(0, 73, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 73, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_parameters = values[0];
    __pyx_v_nClass = values[1];
    __pyx_v_M = values[2];
    __pyx_v_fi = values[3];
    __pyx_v_Omega = values[4];
    __pyx_v_steps = values[5];
    __pyx_v_det_method = values[6];
    __pyx_v_lyapunov_method = values[7];
    __pyx_v_rtol_det = values[8];
    __pyx_v_rtol_lyapunov = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 73, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type___init__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_parameters, __pyx_v_nClass, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_8SIR_type___init__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_nClass, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov) {
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_c = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyross/inference.pyx":74
 * 
 *     def __init__(self, parameters, nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov):
 *         self.Omega = Omega             # <<<<<<<<<<<<<<
 *         self.M = M
 *         self.fi = fi
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_Omega); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error)
  __pyx_v_self->Omega = __pyx_t_1;

  /* "pyross/inference.pyx":75
 *     def __init__(self, parameters, nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov):
 *         self.Omega = Omega
 *         self.M = M             # <<<<<<<<<<<<<<
 *         self.fi = fi
 *         assert steps >= 2, 'Number of steps must be at least 2'
 */
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_M); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error)
  __pyx_v_self->M = __pyx_t_2;

  /* "pyross/inference.pyx":76
 *         self.Omega = Omega
 *         self.M = M
 *         self.fi = fi             # <<<<<<<<<<<<<<
 *         assert steps >= 2, 'Number of steps must be at least 2'
 *         self.steps = steps
 */
  if (!(likely(((__pyx_v_fi) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fi, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 76, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_fi;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->fi);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->fi));
  __pyx_v_self->fi = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":77
 *         self.M = M
 *         self.fi = fi
 *         assert steps >= 2, 'Number of steps must be at least 2'             # <<<<<<<<<<<<<<
 *         self.steps = steps
 *         self.set_params(parameters)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_steps, __pyx_int_2, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 77, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Number_of_steps_must_be_at_least);
      __PYX_ERR(0, 77, __pyx_L1_error)
    }
  }
  #endif

  /* "pyross/inference.pyx":78
 *         self.fi = fi
 *         assert steps >= 2, 'Number of steps must be at least 2'
 *         self.steps = steps             # <<<<<<<<<<<<<<
 *         self.set_params(parameters)
 *         self.det_method=det_method
 */
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_steps); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
  __pyx_v_self->steps = __pyx_t_2;

  /* "pyross/inference.pyx":79
 *         assert steps >= 2, 'Number of steps must be at least 2'
 *         self.steps = steps
 *         self.set_params(parameters)             # <<<<<<<<<<<<<<
 *         self.det_method=det_method
 *         self.lyapunov_method=lyapunov_method
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":80
 *         self.steps = steps
 *         self.set_params(parameters)
 *         self.det_method=det_method             # <<<<<<<<<<<<<<
 *         self.lyapunov_method=lyapunov_method
 *         self.rtol_det = rtol_det
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_det_method))||((__pyx_v_det_method) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_det_method)->tp_name), 0))) __PYX_ERR(0, 80, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_det_method;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->det_method);
  __Pyx_DECREF(__pyx_v_self->det_method);
  __pyx_v_self->det_method = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":81
 *         self.set_params(parameters)
 *         self.det_method=det_method
 *         self.lyapunov_method=lyapunov_method             # <<<<<<<<<<<<<<
 *         self.rtol_det = rtol_det
 *         self.rtol_lyapunov = rtol_lyapunov
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_lyapunov_method))||((__pyx_v_lyapunov_method) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_lyapunov_method)->tp_name), 0))) __PYX_ERR(0, 81, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_lyapunov_method;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->lyapunov_method);
  __Pyx_DECREF(__pyx_v_self->lyapunov_method);
  __pyx_v_self->lyapunov_method = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":82
 *         self.det_method=det_method
 *         self.lyapunov_method=lyapunov_method
 *         self.rtol_det = rtol_det             # <<<<<<<<<<<<<<
 *         self.rtol_lyapunov = rtol_lyapunov
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_rtol_det); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
  __pyx_v_self->rtol_det = __pyx_t_1;

  /* "pyross/inference.pyx":83
 *         self.lyapunov_method=lyapunov_method
 *         self.rtol_det = rtol_det
 *         self.rtol_lyapunov = rtol_lyapunov             # <<<<<<<<<<<<<<
 * 
 *         self.dim = nClass*M
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_rtol_lyapunov); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
  __pyx_v_self->rtol_lyapunov = __pyx_t_1;

  /* "pyross/inference.pyx":85
 *         self.rtol_lyapunov = rtol_lyapunov
 * 
 *         self.dim = nClass*M             # <<<<<<<<<<<<<<
 *         self.nClass = nClass
 *         self.vec_size = int(self.dim*(self.dim+1)/2)
 */
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_nClass, __pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->dim = __pyx_t_2;

  /* "pyross/inference.pyx":86
 * 
 *         self.dim = nClass*M
 *         self.nClass = nClass             # <<<<<<<<<<<<<<
 *         self.vec_size = int(self.dim*(self.dim+1)/2)
 *         self.CM = np.empty((M, M), dtype=DTYPE)
 */
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nClass); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
  __pyx_v_self->nClass = __pyx_t_2;

  /* "pyross/inference.pyx":87
 *         self.dim = nClass*M
 *         self.nClass = nClass
 *         self.vec_size = int(self.dim*(self.dim+1)/2)             # <<<<<<<<<<<<<<
 *         self.CM = np.empty((M, M), dtype=DTYPE)
 *         self.dsigmadt = np.zeros((self.vec_size), dtype=DTYPE)
 */
  __pyx_v_self->vec_size = ((__pyx_v_self->dim * (__pyx_v_self->dim + 1)) / 2);

  /* "pyross/inference.pyx":88
 *         self.nClass = nClass
 *         self.vec_size = int(self.dim*(self.dim+1)/2)
 *         self.CM = np.empty((M, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.dsigmadt = np.zeros((self.vec_size), dtype=DTYPE)
 *         self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_M);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_M);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(__pyx_v_self->CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->CM));
  __pyx_v_self->CM = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":89
 *         self.vec_size = int(self.dim*(self.dim+1)/2)
 *         self.CM = np.empty((M, M), dtype=DTYPE)
 *         self.dsigmadt = np.zeros((self.vec_size), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *         self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_self->vec_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->dsigmadt));
  __pyx_v_self->dsigmadt = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":90
 *         self.CM = np.empty((M, M), dtype=DTYPE)
 *         self.dsigmadt = np.zeros((self.vec_size), dtype=DTYPE)
 *         self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *         self.J_mat = np.empty((self.dim, self.dim), dtype=DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_nClass);
  __Pyx_GIVEREF(__pyx_v_nClass);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_nClass);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_M);
  __Pyx_INCREF(__pyx_v_nClass);
  __Pyx_GIVEREF(__pyx_v_nClass);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_nClass);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_M);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->J);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->J));
  __pyx_v_self->J = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":91
 *         self.dsigmadt = np.zeros((self.vec_size), dtype=DTYPE)
 *         self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *         self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.J_mat = np.empty((self.dim, self.dim), dtype=DTYPE)
 *         self.B_vec = np.empty((self.vec_size), dtype=DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_nClass);
  __Pyx_GIVEREF(__pyx_v_nClass);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_nClass);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_M);
  __Pyx_INCREF(__pyx_v_nClass);
  __Pyx_GIVEREF(__pyx_v_nClass);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_nClass);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_M);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(__pyx_v_self->B);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->B));
  __pyx_v_self->B = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":92
 *         self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *         self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *         self.J_mat = np.empty((self.dim, self.dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.B_vec = np.empty((self.vec_size), dtype=DTYPE)
 *         self.U = np.empty((self.dim, self.dim), dtype=DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __pyx_t_7 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(__pyx_v_self->J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->J_mat));
  __pyx_v_self->J_mat = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":93
 *         self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *         self.J_mat = np.empty((self.dim, self.dim), dtype=DTYPE)
 *         self.B_vec = np.empty((self.vec_size), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.U = np.empty((self.dim, self.dim), dtype=DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_self->vec_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->B_vec));
  __pyx_v_self->B_vec = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":94
 *         self.J_mat = np.empty((self.dim, self.dim), dtype=DTYPE)
 *         self.B_vec = np.empty((self.vec_size), dtype=DTYPE)
 *         self.U = np.empty((self.dim, self.dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         # preparing the indices
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->U);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->U));
  __pyx_v_self->U = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":97
 * 
 *         # preparing the indices
 *         self.rows, self.cols = np.triu_indices(self.dim)             # <<<<<<<<<<<<<<
 *         self.flat_indices = np.ravel_multi_index((self.rows, self.cols), (self.dim, self.dim))
 *         r, c = np.triu_indices(self.dim, k=1)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_triu_indices); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 97, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 97, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 97, __pyx_L1_error)
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->rows);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->rows));
  __pyx_v_self->rows = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->cols);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->cols));
  __pyx_v_self->cols = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":98
 *         # preparing the indices
 *         self.rows, self.cols = np.triu_indices(self.dim)
 *         self.flat_indices = np.ravel_multi_index((self.rows, self.cols), (self.dim, self.dim))             # <<<<<<<<<<<<<<
 *         r, c = np.triu_indices(self.dim, k=1)
 *         self.flat_indices1 = np.ravel_multi_index((r, c), (self.dim, self.dim))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ravel_multi_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->rows));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cols));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->cols));
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
  __pyx_t_7 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_5, __pyx_t_10};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_5, __pyx_t_10};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_t_10);
    __pyx_t_5 = 0;
    __pyx_t_10 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->flat_indices));
  __pyx_v_self->flat_indices = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":99
 *         self.rows, self.cols = np.triu_indices(self.dim)
 *         self.flat_indices = np.ravel_multi_index((self.rows, self.cols), (self.dim, self.dim))
 *         r, c = np.triu_indices(self.dim, k=1)             # <<<<<<<<<<<<<<
 *         self.flat_indices1 = np.ravel_multi_index((r, c), (self.dim, self.dim))
 *         self.flat_indices2 = np.ravel_multi_index((c, r), (self.dim, self.dim))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_triu_indices); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_k, __pyx_int_1) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
    PyObject* sequence = __pyx_t_10;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 99, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_6), 2) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 99, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_c = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":100
 *         self.flat_indices = np.ravel_multi_index((self.rows, self.cols), (self.dim, self.dim))
 *         r, c = np.triu_indices(self.dim, k=1)
 *         self.flat_indices1 = np.ravel_multi_index((r, c), (self.dim, self.dim))             # <<<<<<<<<<<<<<
 *         self.flat_indices2 = np.ravel_multi_index((c, r), (self.dim, self.dim))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ravel_multi_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_r);
  __Pyx_GIVEREF(__pyx_v_r);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_r);
  __Pyx_INCREF(__pyx_v_c);
  __Pyx_GIVEREF(__pyx_v_c);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_c);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_t_9};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_t_9};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_11, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_11, __pyx_t_9);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_10);
  __Pyx_GOTREF(__pyx_v_self->flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->flat_indices1));
  __pyx_v_self->flat_indices1 = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":101
 *         r, c = np.triu_indices(self.dim, k=1)
 *         self.flat_indices1 = np.ravel_multi_index((r, c), (self.dim, self.dim))
 *         self.flat_indices2 = np.ravel_multi_index((c, r), (self.dim, self.dim))             # <<<<<<<<<<<<<<
 * 
 *         self._xm = None
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ravel_multi_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_c);
  __Pyx_GIVEREF(__pyx_v_c);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_c);
  __Pyx_INCREF(__pyx_v_r);
  __Pyx_GIVEREF(__pyx_v_r);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_r);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
  __pyx_t_9 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_5};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_5};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_10);
  __Pyx_GOTREF(__pyx_v_self->flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->flat_indices2));
  __pyx_v_self->flat_indices2 = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":103
 *         self.flat_indices2 = np.ravel_multi_index((c, r), (self.dim, self.dim))
 * 
 *         self._xm = None             # <<<<<<<<<<<<<<
 *         self._interp = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_xm);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_xm));
  __pyx_v_self->_xm = ((PyArrayObject *)Py_None);

  /* "pyross/inference.pyx":104
 * 
 *         self._xm = None
 *         self._interp = None             # <<<<<<<<<<<<<<
 * 
 *         self.param_mapping_enabled = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_interp);
  __Pyx_DECREF(__pyx_v_self->_interp);
  __pyx_v_self->_interp = ((PyObject*)Py_None);

  /* "pyross/inference.pyx":106
 *         self._interp = None
 * 
 *         self.param_mapping_enabled = False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->param_mapping_enabled = 0;

  /* "pyross/inference.pyx":73
 * 
 * 
 *     def __init__(self, parameters, nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov):             # <<<<<<<<<<<<<<
 *         self.Omega = Omega
 *         self.M = M
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":109
 * 
 * 
 *     def infer_parameters(self, x, Tf, contactMatrix, prior_dict, **kwargs):             # <<<<<<<<<<<<<<
 *         """Infers the MAP estimates for epidemiological parameters
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3infer_parameters(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_2infer_parameters[] = "Infers the MAP estimates for epidemiological parameters\n\n        Parameters\n        ----------\n            see `infer`\n\n        Returns\n        -------\n        output: dict\n            Contains the following keys for users:\n\n            map_dict: dict\n                A dictionary for MAPs. Keys are the names of the parameters and\n                the corresponding values are its MAP estimates.\n            -logp: float\n                The value of -logp at MAP.\n\n        Note\n        ----\n        This function just calls `infer` with a fixed contactMatrix function, will be deprecated.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3infer_parameters(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer_parameters (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_prior_dict,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_parameters", 1, 4, 4, 1); __PYX_ERR(0, 109, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_parameters", 1, 4, 4, 2); __PYX_ERR(0, 109, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_parameters", 1, 4, 4, 3); __PYX_ERR(0, 109, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "infer_parameters") < 0)) __PYX_ERR(0, 109, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_contactMatrix = values[2];
    __pyx_v_prior_dict = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer_parameters", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 109, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_2infer_parameters(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_prior_dict, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_2infer_parameters(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("infer_parameters", 0);

  /* "pyross/inference.pyx":133
 * 
 * 
 *         output_dict = self.infer(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                       intervention_fun=None, **kwargs)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_v_Tf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_Tf);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_prior_dict);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_v_contactMatrix) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 133, __pyx_L1_error)

  /* "pyross/inference.pyx":134
 * 
 *         output_dict = self.infer(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,
 *                       intervention_fun=None, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         # match old output dictionary key names (the new implementation of infer uses the same keys as latent_infer)
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_kwargs) < 0) __PYX_ERR(0, 134, __pyx_L1_error)

  /* "pyross/inference.pyx":133
 * 
 * 
 *         output_dict = self.infer(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                       intervention_fun=None, **kwargs)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_output_dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":138
 *         # match old output dictionary key names (the new implementation of infer uses the same keys as latent_infer)
 * 
 *         output_dict['map_dict'] = output_dict['params_dict']             # <<<<<<<<<<<<<<
 *         output_dict['keys'] = output_dict['param_keys']
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_params_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_map_dict, __pyx_t_4) < 0)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":139
 * 
 *         output_dict['map_dict'] = output_dict['params_dict']
 *         output_dict['keys'] = output_dict['param_keys']             # <<<<<<<<<<<<<<
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_param_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_keys, __pyx_t_4) < 0)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":140
 *         output_dict['map_dict'] = output_dict['params_dict']
 *         output_dict['keys'] = output_dict['param_keys']
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']             # <<<<<<<<<<<<<<
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']
 *         output_dict['flat_map'] = output_dict['flat_params']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_param_guess_range); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_flat_guess_range, __pyx_t_4) < 0)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":141
 *         output_dict['keys'] = output_dict['param_keys']
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']             # <<<<<<<<<<<<<<
 *         output_dict['flat_map'] = output_dict['flat_params']
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_scaled_param_guesses); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_scaled_guesses, __pyx_t_4) < 0)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":142
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']
 *         output_dict['flat_map'] = output_dict['flat_params']             # <<<<<<<<<<<<<<
 * 
 *         return output_dict
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_flat_map, __pyx_t_4) < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":144
 *         output_dict['flat_map'] = output_dict['flat_params']
 * 
 *         return output_dict             # <<<<<<<<<<<<<<
 * 
 *     def nested_sampling_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_dict);
  __pyx_r = __pyx_v_output_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":109
 * 
 * 
 *     def infer_parameters(self, x, Tf, contactMatrix, prior_dict, **kwargs):             # <<<<<<<<<<<<<<
 *         """Infers the MAP estimates for epidemiological parameters
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":146
 *         return output_dict
 * 
 *     def nested_sampling_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False,             # <<<<<<<<<<<<<<
 *                                   nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                                   n_effective=None, add_live=True, sampler=None, **dynesty_args):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5nested_sampling_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_4nested_sampling_inference[] = "\n        Run nested sampling for model parameters without latent variables.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.infer_nested_sampling` and will be deleted\n        in a future version of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5nested_sampling_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_v_queue_size = 0;
  PyObject *__pyx_v_maxiter = 0;
  PyObject *__pyx_v_maxcall = 0;
  PyObject *__pyx_v_dlogz = 0;
  PyObject *__pyx_v_n_effective = 0;
  PyObject *__pyx_v_add_live = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_dynesty_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nested_sampling_inference (wrapper)", 0);
  __pyx_v_dynesty_args = PyDict_New(); if (unlikely(!__pyx_v_dynesty_args)) return NULL;
  __Pyx_GOTREF(__pyx_v_dynesty_args);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_prior_dict,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_nprocesses,&__pyx_n_s_queue_size,&__pyx_n_s_maxiter,&__pyx_n_s_maxcall,&__pyx_n_s_dlogz,&__pyx_n_s_n_effective,&__pyx_n_s_add_live,&__pyx_n_s_sampler,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_False);
    values[5] = ((PyObject *)Py_False);
    values[6] = ((PyObject *)__pyx_int_0);

    /* "pyross/inference.pyx":147
 * 
 *     def nested_sampling_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False,
 *                                   nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,             # <<<<<<<<<<<<<<
 *                                   n_effective=None, add_live=True, sampler=None, **dynesty_args):
 *         """
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":148
 *     def nested_sampling_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False,
 *                                   nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                                   n_effective=None, add_live=True, sampler=None, **dynesty_args):             # <<<<<<<<<<<<<<
 *         """
 *         Run nested sampling for model parameters without latent variables.
 */
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_True);
    values[13] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_inference", 0, 4, 14, 1); __PYX_ERR(0, 146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_inference", 0, 4, 14, 2); __PYX_ERR(0, 146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_inference", 0, 4, 14, 3); __PYX_ERR(0, 146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_size);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxiter);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxcall);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dlogz);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_effective);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_add_live);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[13] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_dynesty_args, values, pos_args, "nested_sampling_inference") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_contactMatrix = values[2];
    __pyx_v_prior_dict = values[3];
    __pyx_v_tangent = values[4];
    __pyx_v_verbose = values[5];
    __pyx_v_nprocesses = values[6];
    __pyx_v_queue_size = values[7];
    __pyx_v_maxiter = values[8];
    __pyx_v_maxcall = values[9];
    __pyx_v_dlogz = values[10];
    __pyx_v_n_effective = values[11];
    __pyx_v_add_live = values[12];
    __pyx_v_sampler = values[13];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nested_sampling_inference", 0, 4, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_dynesty_args); __pyx_v_dynesty_args = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_4nested_sampling_inference(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_prior_dict, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_nprocesses, __pyx_v_queue_size, __pyx_v_maxiter, __pyx_v_maxcall, __pyx_v_dlogz, __pyx_v_n_effective, __pyx_v_add_live, __pyx_v_sampler, __pyx_v_dynesty_args);

  /* "pyross/inference.pyx":146
 *         return output_dict
 * 
 *     def nested_sampling_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False,             # <<<<<<<<<<<<<<
 *                                   nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                                   n_effective=None, add_live=True, sampler=None, **dynesty_args):
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_dynesty_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4nested_sampling_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("nested_sampling_inference", 0);

  /* "pyross/inference.pyx":157
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         return self.infer_nested_sampling(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                                           intervention_fun=None, tangent=tangent, verbose=verbose, nprocesses=nprocesses,
 *                                           queue_size=queue_size, maxiter=maxiter, maxcall=maxcall, dlogz=dlogz,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_nested_sampling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_v_Tf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_Tf);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_prior_dict);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_v_contactMatrix) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 157, __pyx_L1_error)

  /* "pyross/inference.pyx":158
 *         """
 *         return self.infer_nested_sampling(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,
 *                                           intervention_fun=None, tangent=tangent, verbose=verbose, nprocesses=nprocesses,             # <<<<<<<<<<<<<<
 *                                           queue_size=queue_size, maxiter=maxiter, maxcall=maxcall, dlogz=dlogz,
 *                                           n_effective=n_effective, add_live=add_live, sampler=sampler, **dynesty_args)
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_verbose, __pyx_v_verbose) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_nprocesses, __pyx_v_nprocesses) < 0) __PYX_ERR(0, 157, __pyx_L1_error)

  /* "pyross/inference.pyx":159
 *         return self.infer_nested_sampling(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,
 *                                           intervention_fun=None, tangent=tangent, verbose=verbose, nprocesses=nprocesses,
 *                                           queue_size=queue_size, maxiter=maxiter, maxcall=maxcall, dlogz=dlogz,             # <<<<<<<<<<<<<<
 *                                           n_effective=n_effective, add_live=add_live, sampler=sampler, **dynesty_args)
 * 
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_queue_size, __pyx_v_queue_size) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxiter, __pyx_v_maxiter) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxcall, __pyx_v_maxcall) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dlogz, __pyx_v_dlogz) < 0) __PYX_ERR(0, 157, __pyx_L1_error)

  /* "pyross/inference.pyx":160
 *                                           intervention_fun=None, tangent=tangent, verbose=verbose, nprocesses=nprocesses,
 *                                           queue_size=queue_size, maxiter=maxiter, maxcall=maxcall, dlogz=dlogz,
 *                                           n_effective=n_effective, add_live=add_live, sampler=sampler, **dynesty_args)             # <<<<<<<<<<<<<<
 * 
 *     def nested_sampling_inference_process_result(self, sampler, prior_dict):
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_effective, __pyx_v_n_effective) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_add_live, __pyx_v_add_live) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sampler, __pyx_v_sampler) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_dynesty_args) < 0) __PYX_ERR(0, 160, __pyx_L1_error)

  /* "pyross/inference.pyx":157
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         return self.infer_nested_sampling(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                                           intervention_fun=None, tangent=tangent, verbose=verbose, nprocesses=nprocesses,
 *                                           queue_size=queue_size, maxiter=maxiter, maxcall=maxcall, dlogz=dlogz,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":146
 *         return output_dict
 * 
 *     def nested_sampling_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False,             # <<<<<<<<<<<<<<
 *                                   nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                                   n_effective=None, add_live=True, sampler=None, **dynesty_args):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":162
 *                                           n_effective=n_effective, add_live=add_live, sampler=sampler, **dynesty_args)
 * 
 *     def nested_sampling_inference_process_result(self, sampler, prior_dict):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `nested_sampling_inference` and produce output dictionaries for further use
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7nested_sampling_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_6nested_sampling_inference_process_result[] = "\n        Take the sampler generated by `nested_sampling_inference` and produce output dictionaries for further use\n        in the pyross framework.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.infer_nested_sampling_process_result` and will be deleted\n        in a future version of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7nested_sampling_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nested_sampling_inference_process_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_prior_dict,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_inference_process_result", 1, 2, 2, 1); __PYX_ERR(0, 162, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nested_sampling_inference_process_result") < 0)) __PYX_ERR(0, 162, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_sampler = values[0];
    __pyx_v_prior_dict = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nested_sampling_inference_process_result", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_6nested_sampling_inference_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_prior_dict);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_6nested_sampling_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_output_samples = NULL;
  PyObject *__pyx_v_out_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_RefNannySetupContext("nested_sampling_inference_process_result", 0);

  /* "pyross/inference.pyx":172
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         result, output_samples = self.infer_nested_sampling_process_result(sampler, prior_dict, contactMatrix=self.contactMatrix,             # <<<<<<<<<<<<<<
 *                                                                            generator=None, intervention_fun=None)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_nested_sampling_process_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_sampler);
  __Pyx_GIVEREF(__pyx_v_sampler);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sampler);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_prior_dict);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_contactMatrix, __pyx_v_self->contactMatrix) < 0) __PYX_ERR(0, 172, __pyx_L1_error)

  /* "pyross/inference.pyx":173
 *         """
 *         result, output_samples = self.infer_nested_sampling_process_result(sampler, prior_dict, contactMatrix=self.contactMatrix,
 *                                                                            generator=None, intervention_fun=None)             # <<<<<<<<<<<<<<
 * 
 *         # Match old dictionary key names for backward compatibility.
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 172, __pyx_L1_error)

  /* "pyross/inference.pyx":172
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         result, output_samples = self.infer_nested_sampling_process_result(sampler, prior_dict, contactMatrix=self.contactMatrix,             # <<<<<<<<<<<<<<
 *                                                                            generator=None, intervention_fun=None)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 172, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_1), 2) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 172, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_output_samples = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":176
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         for out_dict in output_samples:             # <<<<<<<<<<<<<<
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')
 */
  if (likely(PyList_CheckExact(__pyx_v_output_samples)) || PyTuple_CheckExact(__pyx_v_output_samples)) {
    __pyx_t_4 = __pyx_v_output_samples; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_output_samples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 176, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 176, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 176, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_out_dict, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":177
 *         # Match old dictionary key names for backward compatibility.
 *         for out_dict in output_samples:
 *             out_dict['map_dict']         = out_dict.pop('params_dict')             # <<<<<<<<<<<<<<
 *             out_dict['keys']             = out_dict.pop('param_keys')
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_params_dict);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_map_dict, __pyx_t_2) < 0)) __PYX_ERR(0, 177, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":178
 *         for out_dict in output_samples:
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')             # <<<<<<<<<<<<<<
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_param_keys);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_keys, __pyx_t_2) < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":179
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')             # <<<<<<<<<<<<<<
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')
 *             out_dict['flat_map']         = out_dict.pop('flat_params')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_param_guess_range) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_param_guess_range);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_flat_guess_range, __pyx_t_2) < 0)) __PYX_ERR(0, 179, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":180
 *             out_dict['keys']             = out_dict.pop('param_keys')
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')             # <<<<<<<<<<<<<<
 *             out_dict['flat_map']         = out_dict.pop('flat_params')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_scaled_param_guesses) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_scaled_param_guesses);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_scaled_guesses, __pyx_t_2) < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":181
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')
 *             out_dict['flat_map']         = out_dict.pop('flat_params')             # <<<<<<<<<<<<<<
 * 
 *         return result, output_samples
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_flat_params) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_flat_params);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_flat_map, __pyx_t_2) < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":176
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         for out_dict in output_samples:             # <<<<<<<<<<<<<<
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":183
 *             out_dict['flat_map']         = out_dict.pop('flat_params')
 * 
 *         return result, output_samples             # <<<<<<<<<<<<<<
 * 
 *     def mcmc_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False, sampler=None, nwalkers=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_result);
  __Pyx_GIVEREF(__pyx_v_result);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_result);
  __Pyx_INCREF(__pyx_v_output_samples);
  __Pyx_GIVEREF(__pyx_v_output_samples);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_output_samples);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":162
 *                                           n_effective=n_effective, add_live=add_live, sampler=sampler, **dynesty_args)
 * 
 *     def nested_sampling_inference_process_result(self, sampler, prior_dict):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `nested_sampling_inference` and produce output dictionaries for further use
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_out_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":185
 *         return result, output_samples
 * 
 *     def mcmc_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False, sampler=None, nwalkers=None,             # <<<<<<<<<<<<<<
 *                        walker_pos=None, nsamples=1000, nprocesses=0):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_9mcmc_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_8mcmc_inference[] = "\n        Sample the posterior distribution of the epidemiological parameters using ensemble MCMC.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.infer_mcmc` and will be deleted in a future version of pyross.\n        See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_9mcmc_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_nwalkers = 0;
  PyObject *__pyx_v_walker_pos = 0;
  PyObject *__pyx_v_nsamples = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mcmc_inference (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_prior_dict,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_sampler,&__pyx_n_s_nwalkers,&__pyx_n_s_walker_pos,&__pyx_n_s_nsamples,&__pyx_n_s_nprocesses,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_False);
    values[5] = ((PyObject *)Py_False);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":186
 * 
 *     def mcmc_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False, sampler=None, nwalkers=None,
 *                        walker_pos=None, nsamples=1000, nprocesses=0):             # <<<<<<<<<<<<<<
 *         """
 *         Sample the posterior distribution of the epidemiological parameters using ensemble MCMC.
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)__pyx_int_1000);
    values[10] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_inference", 0, 4, 11, 1); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_inference", 0, 4, 11, 2); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_inference", 0, 4, 11, 3); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nwalkers);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_walker_pos);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsamples);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mcmc_inference") < 0)) __PYX_ERR(0, 185, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_contactMatrix = values[2];
    __pyx_v_prior_dict = values[3];
    __pyx_v_tangent = values[4];
    __pyx_v_verbose = values[5];
    __pyx_v_sampler = values[6];
    __pyx_v_nwalkers = values[7];
    __pyx_v_walker_pos = values[8];
    __pyx_v_nsamples = values[9];
    __pyx_v_nprocesses = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mcmc_inference", 0, 4, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_8mcmc_inference(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_prior_dict, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_sampler, __pyx_v_nwalkers, __pyx_v_walker_pos, __pyx_v_nsamples, __pyx_v_nprocesses);

  /* "pyross/inference.pyx":185
 *         return result, output_samples
 * 
 *     def mcmc_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False, sampler=None, nwalkers=None,             # <<<<<<<<<<<<<<
 *                        walker_pos=None, nsamples=1000, nprocesses=0):
 *         """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8mcmc_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mcmc_inference", 0);

  /* "pyross/inference.pyx":195
 *         See there for a documentation of the function parameters.
 *         """
 *         return self.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None, intervention_fun=None,             # <<<<<<<<<<<<<<
 *                                tangent=tangent, verbose=verbose, sampler=sampler, nwalkers=nwalkers,
 *                                walker_pos=walker_pos, nsamples=nsamples, nprocesses=nprocesses)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_mcmc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_v_Tf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_Tf);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_prior_dict);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_contactMatrix, __pyx_v_contactMatrix) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 195, __pyx_L1_error)

  /* "pyross/inference.pyx":196
 *         """
 *         return self.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None, intervention_fun=None,
 *                                tangent=tangent, verbose=verbose, sampler=sampler, nwalkers=nwalkers,             # <<<<<<<<<<<<<<
 *                                walker_pos=walker_pos, nsamples=nsamples, nprocesses=nprocesses)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_verbose, __pyx_v_verbose) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_sampler, __pyx_v_sampler) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nwalkers, __pyx_v_nwalkers) < 0) __PYX_ERR(0, 195, __pyx_L1_error)

  /* "pyross/inference.pyx":197
 *         return self.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None, intervention_fun=None,
 *                                tangent=tangent, verbose=verbose, sampler=sampler, nwalkers=nwalkers,
 *                                walker_pos=walker_pos, nsamples=nsamples, nprocesses=nprocesses)             # <<<<<<<<<<<<<<
 * 
 *     def mcmc_inference_process_result(self, sampler, prior_dict, flat=True, discard=0, thin=1):
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_walker_pos, __pyx_v_walker_pos) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nsamples, __pyx_v_nsamples) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nprocesses, __pyx_v_nprocesses) < 0) __PYX_ERR(0, 195, __pyx_L1_error)

  /* "pyross/inference.pyx":195
 *         See there for a documentation of the function parameters.
 *         """
 *         return self.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, generator=None, intervention_fun=None,             # <<<<<<<<<<<<<<
 *                                tangent=tangent, verbose=verbose, sampler=sampler, nwalkers=nwalkers,
 *                                walker_pos=walker_pos, nsamples=nsamples, nprocesses=nprocesses)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":185
 *         return result, output_samples
 * 
 *     def mcmc_inference(self, x, Tf, contactMatrix, prior_dict, tangent=False, verbose=False, sampler=None, nwalkers=None,             # <<<<<<<<<<<<<<
 *                        walker_pos=None, nsamples=1000, nprocesses=0):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":199
 *                                walker_pos=walker_pos, nsamples=nsamples, nprocesses=nprocesses)
 * 
 *     def mcmc_inference_process_result(self, sampler, prior_dict, flat=True, discard=0, thin=1):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `mcmc_inference` and produce output dictionaries for further use in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_11mcmc_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_10mcmc_inference_process_result[] = "\n        Take the sampler generated by `mcmc_inference` and produce output dictionaries for further use in the\n        pyross framework.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.infer_mcmc_process_result` and will be deleted in a future version\n        of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_11mcmc_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_flat = 0;
  PyObject *__pyx_v_discard = 0;
  PyObject *__pyx_v_thin = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mcmc_inference_process_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_prior_dict,&__pyx_n_s_flat,&__pyx_n_s_discard,&__pyx_n_s_thin,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)__pyx_int_0);
    values[4] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_inference_process_result", 0, 2, 5, 1); __PYX_ERR(0, 199, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flat);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_discard);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thin);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mcmc_inference_process_result") < 0)) __PYX_ERR(0, 199, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sampler = values[0];
    __pyx_v_prior_dict = values[1];
    __pyx_v_flat = values[2];
    __pyx_v_discard = values[3];
    __pyx_v_thin = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mcmc_inference_process_result", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_10mcmc_inference_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_prior_dict, __pyx_v_flat, __pyx_v_discard, __pyx_v_thin);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10mcmc_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin) {
  PyObject *__pyx_v_output_samples = NULL;
  PyObject *__pyx_v_flat_sample_list = NULL;
  PyObject *__pyx_v_out_dict = NULL;
  PyObject *__pyx_7genexpr__pyx_v_sublist = NULL;
  PyObject *__pyx_7genexpr__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_RefNannySetupContext("mcmc_inference_process_result", 0);

  /* "pyross/inference.pyx":209
 *         of pyross. See there for a documentation of the function parameters.
 *         """
 *         output_samples = self.infer_mcmc_process_result(sampler, prior_dict, contactMatrix=self.contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                                                         intervention_fun=None, flat=flat, discard=discard, thin=thin)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_mcmc_process_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_sampler);
  __Pyx_GIVEREF(__pyx_v_sampler);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sampler);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_prior_dict);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_contactMatrix, __pyx_v_self->contactMatrix) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 209, __pyx_L1_error)

  /* "pyross/inference.pyx":210
 *         """
 *         output_samples = self.infer_mcmc_process_result(sampler, prior_dict, contactMatrix=self.contactMatrix, generator=None,
 *                                                         intervention_fun=None, flat=flat, discard=discard, thin=thin)             # <<<<<<<<<<<<<<
 * 
 *         # Match old dictionary key names for backward compatibility.
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_flat, __pyx_v_flat) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_discard, __pyx_v_discard) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_thin, __pyx_v_thin) < 0) __PYX_ERR(0, 209, __pyx_L1_error)

  /* "pyross/inference.pyx":209
 *         of pyross. See there for a documentation of the function parameters.
 *         """
 *         output_samples = self.infer_mcmc_process_result(sampler, prior_dict, contactMatrix=self.contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                                                         intervention_fun=None, flat=flat, discard=discard, thin=thin)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_output_samples = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":213
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         if flat:             # <<<<<<<<<<<<<<
 *             flat_sample_list = output_samples
 *         else:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "pyross/inference.pyx":214
 *         # Match old dictionary key names for backward compatibility.
 *         if flat:
 *             flat_sample_list = output_samples             # <<<<<<<<<<<<<<
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 */
    __Pyx_INCREF(__pyx_v_output_samples);
    __pyx_v_flat_sample_list = __pyx_v_output_samples;

    /* "pyross/inference.pyx":213
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         if flat:             # <<<<<<<<<<<<<<
 *             flat_sample_list = output_samples
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":216
 *             flat_sample_list = output_samples
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]             # <<<<<<<<<<<<<<
 *         for out_dict in flat_sample_list:
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_v_output_samples)) || PyTuple_CheckExact(__pyx_v_output_samples)) {
        __pyx_t_3 = __pyx_v_output_samples; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_output_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_7(__pyx_t_3);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 216, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_sublist, __pyx_t_2);
        __pyx_t_2 = 0;
        if (likely(PyList_CheckExact(__pyx_7genexpr__pyx_v_sublist)) || PyTuple_CheckExact(__pyx_7genexpr__pyx_v_sublist)) {
          __pyx_t_2 = __pyx_7genexpr__pyx_v_sublist; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_7genexpr__pyx_v_sublist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 216, __pyx_L6_error)
        }
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_2))) {
              if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L6_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            } else {
              if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L6_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            }
          } else {
            __pyx_t_1 = __pyx_t_9(__pyx_t_2);
            if (unlikely(!__pyx_t_1)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 216, __pyx_L6_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_item, __pyx_t_1);
          __pyx_t_1 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_7genexpr__pyx_v_item))) __PYX_ERR(0, 216, __pyx_L6_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_item); __pyx_7genexpr__pyx_v_item = 0;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_sublist); __pyx_7genexpr__pyx_v_sublist = 0;
      goto __pyx_L11_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_item); __pyx_7genexpr__pyx_v_item = 0;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_sublist); __pyx_7genexpr__pyx_v_sublist = 0;
      goto __pyx_L1_error;
      __pyx_L11_exit_scope:;
    } /* exit inner scope */
    __pyx_v_flat_sample_list = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":217
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 *         for out_dict in flat_sample_list:             # <<<<<<<<<<<<<<
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')
 */
  if (likely(PyList_CheckExact(__pyx_v_flat_sample_list)) || PyTuple_CheckExact(__pyx_v_flat_sample_list)) {
    __pyx_t_4 = __pyx_v_flat_sample_list; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_flat_sample_list); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 217, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_out_dict, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":218
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 *         for out_dict in flat_sample_list:
 *             out_dict['map_dict']         = out_dict.pop('params_dict')             # <<<<<<<<<<<<<<
 *             out_dict['keys']             = out_dict.pop('param_keys')
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_params_dict);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_map_dict, __pyx_t_3) < 0)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":219
 *         for out_dict in flat_sample_list:
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')             # <<<<<<<<<<<<<<
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_param_keys);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_keys, __pyx_t_3) < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":220
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')             # <<<<<<<<<<<<<<
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')
 *             out_dict['flat_map']         = out_dict.pop('flat_params')
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_param_guess_range) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_param_guess_range);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_flat_guess_range, __pyx_t_3) < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":221
 *             out_dict['keys']             = out_dict.pop('param_keys')
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')             # <<<<<<<<<<<<<<
 *             out_dict['flat_map']         = out_dict.pop('flat_params')
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_scaled_param_guesses) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_scaled_param_guesses);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_scaled_guesses, __pyx_t_3) < 0)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":222
 *             out_dict['flat_guess_range'] = out_dict.pop('param_guess_range')
 *             out_dict['scaled_guesses']   = out_dict.pop('scaled_param_guesses')
 *             out_dict['flat_map']         = out_dict.pop('flat_params')             # <<<<<<<<<<<<<<
 * 
 *         return output_samples
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_flat_params) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_flat_params);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_flat_map, __pyx_t_3) < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":217
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 *         for out_dict in flat_sample_list:             # <<<<<<<<<<<<<<
 *             out_dict['map_dict']         = out_dict.pop('params_dict')
 *             out_dict['keys']             = out_dict.pop('param_keys')
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":224
 *             out_dict['flat_map']         = out_dict.pop('flat_params')
 * 
 *         return output_samples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_samples);
  __pyx_r = __pyx_v_output_samples;
  goto __pyx_L0;

  /* "pyross/inference.pyx":199
 *                                walker_pos=walker_pos, nsamples=nsamples, nprocesses=nprocesses)
 * 
 *     def mcmc_inference_process_result(self, sampler, prior_dict, flat=True, discard=0, thin=1):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `mcmc_inference` and produce output dictionaries for further use in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_flat_sample_list);
  __Pyx_XDECREF(__pyx_v_out_dict);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_sublist);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":227
 * 
 * 
 *     def infer_control(self, x, Tf, generator, prior_dict, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the maximum a-posteriori (MAP) estimate of the change of control parameters for a SIR type model in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13infer_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_12infer_control[] = "\n        Compute the maximum a-posteriori (MAP) estimate of the change of control parameters for a SIR type model in\n        lockdown.\n\n        Parameters\n        ----------\n            see `infer`\n\n        Returns\n        -------\n        output_dict: dict\n            Dictionary of MAP estimates, containing the following keys for users:\n\n            map_dict: dict\n                Dictionary for MAP estimates of the control parameters.\n            -logp: float\n                Value of -logp at MAP.\n\n        Note\n        ----\n        This function just calls `infer` with the specified generator, will be deprecated.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13infer_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer_control (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_generator,&__pyx_n_s_prior_dict,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_control", 1, 4, 4, 1); __PYX_ERR(0, 227, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_control", 1, 4, 4, 2); __PYX_ERR(0, 227, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_control", 1, 4, 4, 3); __PYX_ERR(0, 227, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "infer_control") < 0)) __PYX_ERR(0, 227, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_prior_dict = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer_control", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 227, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_control", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_12infer_control(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_generator, __pyx_v_prior_dict, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_12infer_control(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_generator, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("infer_control", 0);

  /* "pyross/inference.pyx":251
 *         """
 * 
 *         output_dict = self.infer(x, Tf, prior_dict, contactMatrix=None, generator=generator,             # <<<<<<<<<<<<<<
 *                       **kwargs)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_v_Tf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_Tf);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_prior_dict);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, Py_None) < 0) __PYX_ERR(0, 251, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 251, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":252
 * 
 *         output_dict = self.infer(x, Tf, prior_dict, contactMatrix=None, generator=generator,
 *                       **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         # match old output dictionary key names
 */
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_kwargs) < 0) __PYX_ERR(0, 252, __pyx_L1_error)

  /* "pyross/inference.pyx":251
 *         """
 * 
 *         output_dict = self.infer(x, Tf, prior_dict, contactMatrix=None, generator=generator,             # <<<<<<<<<<<<<<
 *                       **kwargs)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_output_dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":255
 * 
 *         # match old output dictionary key names
 *         del output_dict['params_dict']             # <<<<<<<<<<<<<<
 *         output_dict['map_dict'] = output_dict['control_params_dict']
 *         output_dict['keys'] = output_dict['param_keys']
 */
  if (unlikely(PyObject_DelItem(__pyx_v_output_dict, __pyx_n_u_params_dict) < 0)) __PYX_ERR(0, 255, __pyx_L1_error)

  /* "pyross/inference.pyx":256
 *         # match old output dictionary key names
 *         del output_dict['params_dict']
 *         output_dict['map_dict'] = output_dict['control_params_dict']             # <<<<<<<<<<<<<<
 *         output_dict['keys'] = output_dict['param_keys']
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_map_dict, __pyx_t_4) < 0)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":257
 *         del output_dict['params_dict']
 *         output_dict['map_dict'] = output_dict['control_params_dict']
 *         output_dict['keys'] = output_dict['param_keys']             # <<<<<<<<<<<<<<
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_param_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_keys, __pyx_t_4) < 0)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":258
 *         output_dict['map_dict'] = output_dict['control_params_dict']
 *         output_dict['keys'] = output_dict['param_keys']
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']             # <<<<<<<<<<<<<<
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_param_guess_range); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_flat_guess_range, __pyx_t_4) < 0)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":259
 *         output_dict['keys'] = output_dict['param_keys']
 *         output_dict['flat_guess_range'] = output_dict['param_guess_range']
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']             # <<<<<<<<<<<<<<
 * 
 *         return output_dict
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_scaled_param_guesses); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_scaled_guesses, __pyx_t_4) < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":261
 *         output_dict['scaled_guesses'] = output_dict['scaled_param_guesses']
 * 
 *         return output_dict             # <<<<<<<<<<<<<<
 * 
 *     def _loglikelihood(self, params, contactMatrix=None, generator=None, intervention_fun=None, keys=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_dict);
  __pyx_r = __pyx_v_output_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":227
 * 
 * 
 *     def infer_control(self, x, Tf, generator, prior_dict, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the maximum a-posteriori (MAP) estimate of the change of control parameters for a SIR type model in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_control", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":263
 *         return output_dict
 * 
 *     def _loglikelihood(self, params, contactMatrix=None, generator=None, intervention_fun=None, keys=None,             # <<<<<<<<<<<<<<
 *                        x=None, Tf=None, tangent=None,is_scale_parameter=None, flat_guess_range=None,
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_15_loglikelihood(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_14_loglikelihood[] = "Compute the log-likelihood of the model.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_15_loglikelihood(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_keys = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_is_scale_parameter = 0;
  PyObject *__pyx_v_flat_guess_range = 0;
  PyObject *__pyx_v_scaled_guesses = 0;
  PyObject *__pyx_v_bounds = 0;
  PyObject *__pyx_v_inter_steps = 0;
  CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_loglikelihood (wrapper)", 0);
  __pyx_v_catchall_kwargs = PyDict_New(); if (unlikely(!__pyx_v_catchall_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_catchall_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_keys,&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_tangent,&__pyx_n_s_is_scale_parameter,&__pyx_n_s_flat_guess_range,&__pyx_n_s_scaled_guesses,&__pyx_n_s_bounds,&__pyx_n_s_inter_steps,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":264
 * 
 *     def _loglikelihood(self, params, contactMatrix=None, generator=None, intervention_fun=None, keys=None,
 *                        x=None, Tf=None, tangent=None,is_scale_parameter=None, flat_guess_range=None,             # <<<<<<<<<<<<<<
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):
 *         """Compute the log-likelihood of the model."""
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":265
 *     def _loglikelihood(self, params, contactMatrix=None, generator=None, intervention_fun=None, keys=None,
 *                        x=None, Tf=None, tangent=None,is_scale_parameter=None, flat_guess_range=None,
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):             # <<<<<<<<<<<<<<
 *         """Compute the log-likelihood of the model."""
 *         if bounds is not None:
 */
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keys);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_scale_parameter);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flat_guess_range);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaled_guesses);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bounds);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_catchall_kwargs, values, pos_args, "_loglikelihood") < 0)) __PYX_ERR(0, 263, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_contactMatrix = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_intervention_fun = values[3];
    __pyx_v_keys = values[4];
    __pyx_v_x = values[5];
    __pyx_v_Tf = values[6];
    __pyx_v_tangent = values[7];
    __pyx_v_is_scale_parameter = values[8];
    __pyx_v_flat_guess_range = values[9];
    __pyx_v_scaled_guesses = values[10];
    __pyx_v_bounds = values[11];
    __pyx_v_inter_steps = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_loglikelihood", 0, 1, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_catchall_kwargs); __pyx_v_catchall_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type._loglikelihood", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_14_loglikelihood(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_keys, __pyx_v_x, __pyx_v_Tf, __pyx_v_tangent, __pyx_v_is_scale_parameter, __pyx_v_flat_guess_range, __pyx_v_scaled_guesses, __pyx_v_bounds, __pyx_v_inter_steps, __pyx_v_catchall_kwargs);

  /* "pyross/inference.pyx":263
 *         return output_dict
 * 
 *     def _loglikelihood(self, params, contactMatrix=None, generator=None, intervention_fun=None, keys=None,             # <<<<<<<<<<<<<<
 *                        x=None, Tf=None, tangent=None,is_scale_parameter=None, flat_guess_range=None,
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_catchall_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_14_loglikelihood(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_keys, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_tangent, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_flat_guess_range, PyObject *__pyx_v_scaled_guesses, PyObject *__pyx_v_bounds, PyObject *__pyx_v_inter_steps, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs) {
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_parameters = NULL;
  PyObject *__pyx_v_kwargs = NULL;
  double __pyx_v_minus_logl;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  double __pyx_t_12;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj __pyx_t_13;
  __Pyx_RefNannySetupContext("_loglikelihood", 0);

  /* "pyross/inference.pyx":267
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):
 *         """Compute the log-likelihood of the model."""
 *         if bounds is not None:             # <<<<<<<<<<<<<<
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):
 */
  __pyx_t_1 = (__pyx_v_bounds != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":269
 *         if bounds is not None:
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_any); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_params, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_params, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "pyross/inference.pyx":270
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):
 *                 return -np.Inf             # <<<<<<<<<<<<<<
 * 
 *         # Restore parameters from flattened parameters
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Inf); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Negative(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "pyross/inference.pyx":269
 *         if bounds is not None:
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 * 
 */
    }

    /* "pyross/inference.pyx":267
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):
 *         """Compute the log-likelihood of the model."""
 *         if bounds is not None:             # <<<<<<<<<<<<<<
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):
 */
  }

  /* "pyross/inference.pyx":273
 * 
 *         # Restore parameters from flattened parameters
 *         orig_params = pyross.utils.unflatten_parameters(params, flat_guess_range,             # <<<<<<<<<<<<<<
 *                                                         is_scale_parameter, scaled_guesses)
 *         parameters, kwargs = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyross); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":274
 *         # Restore parameters from flattened parameters
 *         orig_params = pyross.utils.unflatten_parameters(params, flat_guess_range,
 *                                                         is_scale_parameter, scaled_guesses)             # <<<<<<<<<<<<<<
 *         parameters, kwargs = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 * 
 */
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_params, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_params, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_params);
    __Pyx_GIVEREF(__pyx_v_params);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_params);
    __Pyx_INCREF(__pyx_v_flat_guess_range);
    __Pyx_GIVEREF(__pyx_v_flat_guess_range);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_flat_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_guesses);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_scaled_guesses);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_orig_params = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":275
 *         orig_params = pyross.utils.unflatten_parameters(params, flat_guess_range,
 *                                                         is_scale_parameter, scaled_guesses)
 *         parameters, kwargs = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 * 
 *         self.set_params(parameters)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_keys);
  __Pyx_GIVEREF(__pyx_v_keys);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_orig_params);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 275, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 275, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_parameters = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kwargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":277
 *         parameters, kwargs = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 * 
 *         self.set_params(parameters)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":279
 *         self.set_params(parameters)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 */
  __pyx_t_2 = (__pyx_v_generator != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":280
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 *             else:
 */
    __pyx_t_1 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "pyross/inference.pyx":281
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__pyx_v_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 281, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
        __pyx_t_6 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pyross/inference.pyx":280
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 *             else:
 */
      goto __pyx_L10;
    }

    /* "pyross/inference.pyx":283
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)             # <<<<<<<<<<<<<<
 *         else:
 *             if kwargs != {}:
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 283, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
        __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L10:;

    /* "pyross/inference.pyx":279
 *         self.set_params(parameters)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 */
    goto __pyx_L9;
  }

  /* "pyross/inference.pyx":285
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)
 *         else:
 *             if kwargs != {}:             # <<<<<<<<<<<<<<
 *                 raise Exception('Key error or unspecified generator')
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_kwargs, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "pyross/inference.pyx":286
 *         else:
 *             if kwargs != {}:
 *                 raise Exception('Key error or unspecified generator')             # <<<<<<<<<<<<<<
 * 
 *         if tangent:
 */
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 286, __pyx_L1_error)

      /* "pyross/inference.pyx":285
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)
 *         else:
 *             if kwargs != {}:             # <<<<<<<<<<<<<<
 *                 raise Exception('Key error or unspecified generator')
 * 
 */
    }
  }
  __pyx_L9:;

  /* "pyross/inference.pyx":288
 *                 raise Exception('Key error or unspecified generator')
 * 
 *         if tangent:             # <<<<<<<<<<<<<<
 *             minus_logl = self._obtain_logp_for_traj_tangent(x, Tf)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":289
 * 
 *         if tangent:
 *             minus_logl = self._obtain_logp_for_traj_tangent(x, Tf)             # <<<<<<<<<<<<<<
 *         else:
 *             minus_logl = self._obtain_logp_for_traj(x, Tf, inter_steps)
 */
    __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 289, __pyx_L1_error)
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
    __pyx_v_minus_logl = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_obtain_logp_for_traj_tangent(__pyx_v_self, __pyx_t_9, __pyx_t_10);
    __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;

    /* "pyross/inference.pyx":288
 *                 raise Exception('Key error or unspecified generator')
 * 
 *         if tangent:             # <<<<<<<<<<<<<<
 *             minus_logl = self._obtain_logp_for_traj_tangent(x, Tf)
 *         else:
 */
    goto __pyx_L12;
  }

  /* "pyross/inference.pyx":291
 *             minus_logl = self._obtain_logp_for_traj_tangent(x, Tf)
 *         else:
 *             minus_logl = self._obtain_logp_for_traj(x, Tf, inter_steps)             # <<<<<<<<<<<<<<
 * 
 *         return -minus_logl
 */
  /*else*/ {
    __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 291, __pyx_L1_error)
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_inter_steps); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L1_error)
    __pyx_t_13.__pyx_n = 1;
    __pyx_t_13.inter_steps = __pyx_t_11;
    __pyx_t_12 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_obtain_logp_for_traj(__pyx_v_self, __pyx_t_9, __pyx_t_10, &__pyx_t_13); 
    __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;
    __pyx_v_minus_logl = __pyx_t_12;
  }
  __pyx_L12:;

  /* "pyross/inference.pyx":293
 *             minus_logl = self._obtain_logp_for_traj(x, Tf, inter_steps)
 * 
 *         return -minus_logl             # <<<<<<<<<<<<<<
 * 
 *     def _logposterior(self, params, prior=None, **logl_kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_minus_logl)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":263
 *         return output_dict
 * 
 *     def _loglikelihood(self, params, contactMatrix=None, generator=None, intervention_fun=None, keys=None,             # <<<<<<<<<<<<<<
 *                        x=None, Tf=None, tangent=None,is_scale_parameter=None, flat_guess_range=None,
 *                        scaled_guesses=None, bounds=None, inter_steps=0, **catchall_kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._loglikelihood", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":295
 *         return -minus_logl
 * 
 *     def _logposterior(self, params, prior=None, **logl_kwargs):             # <<<<<<<<<<<<<<
 *         """Compute the log-posterior (up to a constant) of the model."""
 *         logl = self._loglikelihood(params, **logl_kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_17_logposterior(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_16_logposterior[] = "Compute the log-posterior (up to a constant) of the model.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_17_logposterior(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  PyObject *__pyx_v_prior = 0;
  PyObject *__pyx_v_logl_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_logposterior (wrapper)", 0);
  __pyx_v_logl_kwargs = PyDict_New(); if (unlikely(!__pyx_v_logl_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_logl_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_prior,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_logl_kwargs, values, pos_args, "_logposterior") < 0)) __PYX_ERR(0, 295, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_prior = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_logposterior", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_logl_kwargs); __pyx_v_logl_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type._logposterior", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_16_logposterior(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_prior, __pyx_v_logl_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_logl_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_16_logposterior(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, PyObject *__pyx_v_prior, PyObject *__pyx_v_logl_kwargs) {
  PyObject *__pyx_v_logl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_logposterior", 0);

  /* "pyross/inference.pyx":297
 *     def _logposterior(self, params, prior=None, **logl_kwargs):
 *         """Compute the log-posterior (up to a constant) of the model."""
 *         logl = self._loglikelihood(params, **logl_kwargs)             # <<<<<<<<<<<<<<
 *         return logl + np.sum(prior.logpdf(params))
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglikelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_params);
  __Pyx_GIVEREF(__pyx_v_params);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_params);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_logl_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_logl = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":298
 *         """Compute the log-posterior (up to a constant) of the model."""
 *         logl = self._loglikelihood(params, **logl_kwargs)
 *         return logl + np.sum(prior.logpdf(params))             # <<<<<<<<<<<<<<
 * 
 *     def _infer_to_minimize(self, params, grad=0, **logp_kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_params) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_params);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_v_logl, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":295
 *         return -minus_logl
 * 
 *     def _logposterior(self, params, prior=None, **logl_kwargs):             # <<<<<<<<<<<<<<
 *         """Compute the log-posterior (up to a constant) of the model."""
 *         logl = self._loglikelihood(params, **logl_kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SIR_type._logposterior", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":300
 *         return logl + np.sum(prior.logpdf(params))
 * 
 *     def _infer_to_minimize(self, params, grad=0, **logp_kwargs):             # <<<<<<<<<<<<<<
 *         """Objective function for minimization call in infer."""
 *         return -self._logposterior(params, **logp_kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_19_infer_to_minimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_18_infer_to_minimize[] = "Objective function for minimization call in infer.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_19_infer_to_minimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_grad = 0;
  PyObject *__pyx_v_logp_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_infer_to_minimize (wrapper)", 0);
  __pyx_v_logp_kwargs = PyDict_New(); if (unlikely(!__pyx_v_logp_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_logp_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_grad,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_logp_kwargs, values, pos_args, "_infer_to_minimize") < 0)) __PYX_ERR(0, 300, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_grad = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_infer_to_minimize", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_logp_kwargs); __pyx_v_logp_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type._infer_to_minimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_18_infer_to_minimize(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_grad, __pyx_v_logp_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_logp_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_18_infer_to_minimize(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_grad, PyObject *__pyx_v_logp_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_infer_to_minimize", 0);

  /* "pyross/inference.pyx":302
 *     def _infer_to_minimize(self, params, grad=0, **logp_kwargs):
 *         """Objective function for minimization call in infer."""
 *         return -self._logposterior(params, **logp_kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def infer(self, x, Tf, prior_dict, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_params);
  __Pyx_GIVEREF(__pyx_v_params);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_params);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_logp_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":300
 *         return logl + np.sum(prior.logpdf(params))
 * 
 *     def _infer_to_minimize(self, params, grad=0, **logp_kwargs):             # <<<<<<<<<<<<<<
 *         """Objective function for minimization call in infer."""
 *         return -self._logposterior(params, **logp_kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SIR_type._infer_to_minimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":304
 *         return -self._logposterior(params, **logp_kwargs)
 * 
 *     def infer(self, x, Tf, prior_dict, contactMatrix=None,             # <<<<<<<<<<<<<<
 *               generator=None, intervention_fun=None, tangent=False,
 *               verbose=False, ftol=1e-6,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_21infer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_20infer[] = "\n        Compute the maximum a-posteriori (MAP) estimate for all desired parameters, including control parameters, for an SIR type model\n        with fully observed classes. If `generator` is specified, the lockdown is modelled by scaling the contact matrices for contact at work,\n        school, and other (but not home). This function infers the scaling parameters (can be age dependent) assuming that full data\n        on all classes is available (with latent variables, use `latent_infer`).\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        prior_dict: dict\n            A dictionary containing priors for parameters (can include both model and intervention parameters). See examples.\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space infere""nce. Default is false.\n        verbose: bool, optional\n            Set to True to see intermediate outputs from the optimizer.\n        ftol: double\n            Relative tolerance of logp\n        global_max_iter: int, optional\n            Number of global optimisations performed.\n        local_max_iter: int, optional\n            Number of local optimisation performed.\n        global_atol: float\n            The absolute tolerance for global optimisation.\n        enable_global: bool, optional\n            Set to True to enable global optimisation.\n        enable_local: bool, optional\n            Set to True to enable local optimisation.\n        cma_processes: int, optional\n            Number of parallel processes used for global optimisation.\n        cma_population: int, optional\n            The number of samples used in each step of the CMA algorithm.\n        cma_random_seed: int (between 0 and 2**32-1)\n            Random seed for the optimisation algorithms. By default it is generated from numpy.random.randint.\n\n        Returns\n        -------\n        output_dict: dict\n            Dictionary of MAP estimates, containing the following keys for users:\n\n            params_dict: dict\n                Dictionary for MAP estimates of the model parameters.\n            control_params_dict: dict\n                Dictionary for MAP estimates of the control parameters (if requested).\n            -logp: float\n                Value of -logp at MAP.\n        Note\n        ----\n        This function combines the functionality of `infer_parameters` and `infer_control`,\n        which will be deprecated.\n        To infer model parameters only, specify a fixed `contactMatrix` function.\n        To infer control parameters only, specify a `generator` and do not specify priors for model parameters.\n\n        Examples\n        --------\n        An example of prior_dict to set priors for alpha and beta, where alpha\n        is age dependent and we want to i""nfer its scale parameters rather than\n        each component individually. The prior distribution is assumed to be\n        log-normal with the specified mean and standard deviation.\n\n        >>> prior_dict = {\n                'alpha':{\n                    'mean': [0.5, 0.2],\n                    'infer_scale': True,\n                    'scale_factor_std': 1,\n                    'scale_factor_bounds': [0.1, 10],\n                    'prior_fun': 'truncnorm'\n                },\n                'beta':{\n                    'mean': 0.02,\n                    'std': 0.1,\n                    'bounds': [1e-4, 1],\n                    'prior_fun': 'lognorm'\n                }\n            }\n\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_21infer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_ftol = 0;
  PyObject *__pyx_v_global_max_iter = 0;
  PyObject *__pyx_v_local_max_iter = 0;
  PyObject *__pyx_v_global_atol = 0;
  PyObject *__pyx_v_enable_global = 0;
  PyObject *__pyx_v_enable_local = 0;
  PyObject *__pyx_v_cma_processes = 0;
  PyObject *__pyx_v_cma_population = 0;
  PyObject *__pyx_v_cma_random_seed = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_prior_dict,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_ftol,&__pyx_n_s_global_max_iter,&__pyx_n_s_local_max_iter,&__pyx_n_s_global_atol,&__pyx_n_s_enable_global,&__pyx_n_s_enable_local,&__pyx_n_s_cma_processes,&__pyx_n_s_cma_population,&__pyx_n_s_cma_random_seed,0};
    PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":305
 * 
 *     def infer(self, x, Tf, prior_dict, contactMatrix=None,
 *               generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *               verbose=False, ftol=1e-6,
 *               global_max_iter=100, local_max_iter=100, global_atol=1.,
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_False);

    /* "pyross/inference.pyx":306
 *     def infer(self, x, Tf, prior_dict, contactMatrix=None,
 *               generator=None, intervention_fun=None, tangent=False,
 *               verbose=False, ftol=1e-6,             # <<<<<<<<<<<<<<
 *               global_max_iter=100, local_max_iter=100, global_atol=1.,
 *               enable_global=True, enable_local=True,
 */
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)__pyx_float_1eneg_6);
    values[9] = ((PyObject *)__pyx_int_100);
    values[10] = ((PyObject *)__pyx_int_100);
    values[11] = ((PyObject *)__pyx_float_1_);

    /* "pyross/inference.pyx":308
 *               verbose=False, ftol=1e-6,
 *               global_max_iter=100, local_max_iter=100, global_atol=1.,
 *               enable_global=True, enable_local=True,             # <<<<<<<<<<<<<<
 *               cma_processes=0, cma_population=16, cma_random_seed=None):
 *         """
 */
    values[12] = ((PyObject *)Py_True);
    values[13] = ((PyObject *)Py_True);
    values[14] = ((PyObject *)__pyx_int_0);
    values[15] = ((PyObject *)__pyx_int_16);

    /* "pyross/inference.pyx":309
 *               global_max_iter=100, local_max_iter=100, global_atol=1.,
 *               enable_global=True, enable_local=True,
 *               cma_processes=0, cma_population=16, cma_random_seed=None):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the maximum a-posteriori (MAP) estimate for all desired parameters, including control parameters, for an SIR type model
 */
    values[16] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer", 0, 3, 17, 1); __PYX_ERR(0, 304, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer", 0, 3, 17, 2); __PYX_ERR(0, 304, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ftol);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_max_iter);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_local_max_iter);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_atol);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enable_global);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enable_local);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cma_processes);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cma_population);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cma_random_seed);
          if (value) { values[16] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "infer") < 0)) __PYX_ERR(0, 304, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_prior_dict = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_verbose = values[7];
    __pyx_v_ftol = values[8];
    __pyx_v_global_max_iter = values[9];
    __pyx_v_local_max_iter = values[10];
    __pyx_v_global_atol = values[11];
    __pyx_v_enable_global = values[12];
    __pyx_v_enable_local = values[13];
    __pyx_v_cma_processes = values[14];
    __pyx_v_cma_population = values[15];
    __pyx_v_cma_random_seed = values[16];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer", 0, 3, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 304, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_20infer(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_prior_dict, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_ftol, __pyx_v_global_max_iter, __pyx_v_local_max_iter, __pyx_v_global_atol, __pyx_v_enable_global, __pyx_v_enable_local, __pyx_v_cma_processes, __pyx_v_cma_population, __pyx_v_cma_random_seed);

  /* "pyross/inference.pyx":304
 *         return -self._logposterior(params, **logp_kwargs)
 * 
 *     def infer(self, x, Tf, prior_dict, contactMatrix=None,             # <<<<<<<<<<<<<<
 *               generator=None, intervention_fun=None, tangent=False,
 *               verbose=False, ftol=1e-6,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_20infer(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_ftol, PyObject *__pyx_v_global_max_iter, PyObject *__pyx_v_local_max_iter, PyObject *__pyx_v_global_atol, PyObject *__pyx_v_enable_global, PyObject *__pyx_v_enable_local, PyObject *__pyx_v_cma_processes, PyObject *__pyx_v_cma_population, PyObject *__pyx_v_cma_random_seed) {
  PyObject *__pyx_v_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_flat_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_guesses = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_cma_stds = NULL;
  PyObject *__pyx_v_minimize_args = NULL;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_t_14;
  __Pyx_RefNannySetupContext("infer", 0);

  /* "pyross/inference.pyx":406
 * 
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":411
 *         prior_names, keys, guess, stds, bounds, \
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 *         prior = Prior(prior_names, bounds, guess, stds)
 *         cma_stds = np.minimum(stds, (bounds[:, 1] - bounds[:, 0])/3)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_check_length, __pyx_t_3) < 0) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 409, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 409, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
    __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 8) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 409, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "pyross/inference.pyx":409
 * 
 *         # Read in parameter priors
 *         prior_names, keys, guess, stds, bounds, \             # <<<<<<<<<<<<<<
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_prior_names = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_keys = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_bounds = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_flat_guess_range = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_scaled_guesses = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":412
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 *         cma_stds = np.minimum(stds, (bounds[:, 1] - bounds[:, 0])/3)
 *         minimize_args = {'keys':keys, 'x':x, 'Tf':Tf,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_prior_names);
    __Pyx_GIVEREF(__pyx_v_prior_names);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_v_prior_names);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_prior = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":413
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)
 *         cma_stds = np.minimum(stds, (bounds[:, 1] - bounds[:, 0])/3)             # <<<<<<<<<<<<<<
 *         minimize_args = {'keys':keys, 'x':x, 'Tf':Tf,
 *                          'flat_guess_range':flat_guess_range,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_minimum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = PyNumber_Subtract(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_7, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_stds, __pyx_t_9};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_stds, __pyx_t_9};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_v_stds);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_cma_stds = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":414
 *         prior = Prior(prior_names, bounds, guess, stds)
 *         cma_stds = np.minimum(stds, (bounds[:, 1] - bounds[:, 0])/3)
 *         minimize_args = {'keys':keys, 'x':x, 'Tf':Tf,             # <<<<<<<<<<<<<<
 *                          'flat_guess_range':flat_guess_range,
 *                          'is_scale_parameter':is_scale_parameter,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_x, __pyx_v_x) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 414, __pyx_L1_error)

  /* "pyross/inference.pyx":415
 *         cma_stds = np.minimum(stds, (bounds[:, 1] - bounds[:, 0])/3)
 *         minimize_args = {'keys':keys, 'x':x, 'Tf':Tf,
 *                          'flat_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *                          'is_scale_parameter':is_scale_parameter,
 *                          'scaled_guesses': scaled_guesses,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_flat_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 414, __pyx_L1_error)

  /* "pyross/inference.pyx":416
 *         minimize_args = {'keys':keys, 'x':x, 'Tf':Tf,
 *                          'flat_guess_range':flat_guess_range,
 *                          'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                          'scaled_guesses': scaled_guesses,
 *                          'generator':generator, 'prior':prior,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 414, __pyx_L1_error)

  /* "pyross/inference.pyx":417
 *                          'flat_guess_range':flat_guess_range,
 *                          'is_scale_parameter':is_scale_parameter,
 *                          'scaled_guesses': scaled_guesses,             # <<<<<<<<<<<<<<
 *                          'generator':generator, 'prior':prior,
 *                          'intervention_fun': intervention_fun, 'tangent': tangent}
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_scaled_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 414, __pyx_L1_error)

  /* "pyross/inference.pyx":418
 *                          'is_scale_parameter':is_scale_parameter,
 *                          'scaled_guesses': scaled_guesses,
 *                          'generator':generator, 'prior':prior,             # <<<<<<<<<<<<<<
 *                          'intervention_fun': intervention_fun, 'tangent': tangent}
 *         res = minimization(self._infer_to_minimize, guess, bounds, ftol=ftol, global_max_iter=global_max_iter,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 414, __pyx_L1_error)

  /* "pyross/inference.pyx":419
 *                          'scaled_guesses': scaled_guesses,
 *                          'generator':generator, 'prior':prior,
 *                          'intervention_fun': intervention_fun, 'tangent': tangent}             # <<<<<<<<<<<<<<
 *         res = minimization(self._infer_to_minimize, guess, bounds, ftol=ftol, global_max_iter=global_max_iter,
 *                            local_max_iter=local_max_iter, global_atol=global_atol,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
  __pyx_v_minimize_args = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":420
 *                          'generator':generator, 'prior':prior,
 *                          'intervention_fun': intervention_fun, 'tangent': tangent}
 *         res = minimization(self._infer_to_minimize, guess, bounds, ftol=ftol, global_max_iter=global_max_iter,             # <<<<<<<<<<<<<<
 *                            local_max_iter=local_max_iter, global_atol=global_atol,
 *                            enable_global=enable_global, enable_local=enable_local, cma_processes=cma_processes,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_minimization); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_to_minimize); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_guess);
  __Pyx_GIVEREF(__pyx_v_guess);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_guess);
  __Pyx_INCREF(__pyx_v_bounds);
  __Pyx_GIVEREF(__pyx_v_bounds);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_bounds);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_ftol, __pyx_v_ftol) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_global_max_iter, __pyx_v_global_max_iter) < 0) __PYX_ERR(0, 420, __pyx_L1_error)

  /* "pyross/inference.pyx":421
 *                          'intervention_fun': intervention_fun, 'tangent': tangent}
 *         res = minimization(self._infer_to_minimize, guess, bounds, ftol=ftol, global_max_iter=global_max_iter,
 *                            local_max_iter=local_max_iter, global_atol=global_atol,             # <<<<<<<<<<<<<<
 *                            enable_global=enable_global, enable_local=enable_local, cma_processes=cma_processes,
 *                            cma_population=cma_population, cma_stds=cma_stds, verbose=verbose, args_dict=minimize_args, cma_random_seed=cma_random_seed)
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_local_max_iter, __pyx_v_local_max_iter) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_global_atol, __pyx_v_global_atol) < 0) __PYX_ERR(0, 420, __pyx_L1_error)

  /* "pyross/inference.pyx":422
 *         res = minimization(self._infer_to_minimize, guess, bounds, ftol=ftol, global_max_iter=global_max_iter,
 *                            local_max_iter=local_max_iter, global_atol=global_atol,
 *                            enable_global=enable_global, enable_local=enable_local, cma_processes=cma_processes,             # <<<<<<<<<<<<<<
 *                            cma_population=cma_population, cma_stds=cma_stds, verbose=verbose, args_dict=minimize_args, cma_random_seed=cma_random_seed)
 * 
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_enable_global, __pyx_v_enable_global) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_enable_local, __pyx_v_enable_local) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_cma_processes, __pyx_v_cma_processes) < 0) __PYX_ERR(0, 420, __pyx_L1_error)

  /* "pyross/inference.pyx":423
 *                            local_max_iter=local_max_iter, global_atol=global_atol,
 *                            enable_global=enable_global, enable_local=enable_local, cma_processes=cma_processes,
 *                            cma_population=cma_population, cma_stds=cma_stds, verbose=verbose, args_dict=minimize_args, cma_random_seed=cma_random_seed)             # <<<<<<<<<<<<<<
 * 
 *         orig_params = pyross.utils.unflatten_parameters(res[0], flat_guess_range,
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_cma_population, __pyx_v_cma_population) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_cma_stds, __pyx_v_cma_stds) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_verbose, __pyx_v_verbose) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_args_dict, __pyx_v_minimize_args) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_cma_random_seed, __pyx_v_cma_random_seed) < 0) __PYX_ERR(0, 420, __pyx_L1_error)

  /* "pyross/inference.pyx":420
 *                          'generator':generator, 'prior':prior,
 *                          'intervention_fun': intervention_fun, 'tangent': tangent}
 *         res = minimization(self._infer_to_minimize, guess, bounds, ftol=ftol, global_max_iter=global_max_iter,             # <<<<<<<<<<<<<<
 *                            local_max_iter=local_max_iter, global_atol=global_atol,
 *                            enable_global=enable_global, enable_local=enable_local, cma_processes=cma_processes,
 */
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_res = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":425
 *                            cma_population=cma_population, cma_stds=cma_stds, verbose=verbose, args_dict=minimize_args, cma_random_seed=cma_random_seed)
 * 
 *         orig_params = pyross.utils.unflatten_parameters(res[0], flat_guess_range,             # <<<<<<<<<<<<<<
 *                                              is_scale_parameter, scaled_guesses)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyross); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_utils); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);

  /* "pyross/inference.pyx":426
 * 
 *         orig_params = pyross.utils.unflatten_parameters(res[0], flat_guess_range,
 *                                              is_scale_parameter, scaled_guesses)             # <<<<<<<<<<<<<<
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_10, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 425, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_10, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 425, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_4, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_flat_guess_range);
    __Pyx_GIVEREF(__pyx_v_flat_guess_range);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_4, __pyx_v_flat_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_guesses);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_4, __pyx_v_scaled_guesses);
    __pyx_t_10 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_orig_params = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":428
 *                                              is_scale_parameter, scaled_guesses)
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *         self.set_params(map_params_dict)
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_keys);
  __Pyx_GIVEREF(__pyx_v_keys);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_orig_params);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 428, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
    PyObject* sequence = __pyx_t_10;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 428, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 1; __pyx_t_8 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_9), 2) < 0) __PYX_ERR(0, 428, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 428, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_map_params_dict = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_map_control_params_dict = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":429
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 *         self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_10 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pyross/inference.pyx":431
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  __pyx_t_13 = (__pyx_v_generator != Py_None);
  __pyx_t_14 = (__pyx_t_13 != 0);
  if (__pyx_t_14) {

    /* "pyross/inference.pyx":432
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
    __pyx_t_14 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_13 = (__pyx_t_14 != 0);
    if (__pyx_t_13) {

      /* "pyross/inference.pyx":433
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 433, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_8 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 433, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_8 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 433, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pyross/inference.pyx":432
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
      goto __pyx_L8;
    }

    /* "pyross/inference.pyx":435
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         l_post = -res[1]
 */
    /*else*/ {
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 435, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 435, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 435, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_10 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      } else {
        __pyx_t_10 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 435, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GIVEREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __pyx_L8:;

    /* "pyross/inference.pyx":431
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  }

  /* "pyross/inference.pyx":437
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *         l_post = -res[1]             # <<<<<<<<<<<<<<
 *         l_prior = np.sum(prior.logpdf(res[0]))
 *         l_like = l_post - l_prior
 */
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_res, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyNumber_Negative(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_l_post = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":438
 * 
 *         l_post = -res[1]
 *         l_prior = np.sum(prior.logpdf(res[0]))             # <<<<<<<<<<<<<<
 *         l_like = l_post - l_prior
 *         output_dict = {
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_10 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_l_prior = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":439
 *         l_post = -res[1]
 *         l_prior = np.sum(prior.logpdf(res[0]))
 *         l_like = l_post - l_prior             # <<<<<<<<<<<<<<
 *         output_dict = {
 *             'params_dict': map_params_dict, 'flat_params': res[0], 'param_keys': keys,
 */
  __pyx_t_10 = PyNumber_Subtract(__pyx_v_l_post, __pyx_v_l_prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v_l_like = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":441
 *         l_like = l_post - l_prior
 *         output_dict = {
 *             'params_dict': map_params_dict, 'flat_params': res[0], 'param_keys': keys,             # <<<<<<<<<<<<<<
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *             'is_scale_parameter':is_scale_parameter,
 */
  __pyx_t_10 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_params_dict, __pyx_v_map_params_dict) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_flat_params, __pyx_t_8) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 441, __pyx_L1_error)

  /* "pyross/inference.pyx":442
 *         output_dict = {
 *             'params_dict': map_params_dict, 'flat_params': res[0], 'param_keys': keys,
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,             # <<<<<<<<<<<<<<
 *             'is_scale_parameter':is_scale_parameter,
 *             'param_guess_range':flat_guess_range,
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0) __PYX_ERR(0, 441, __pyx_L1_error)

  /* "pyross/inference.pyx":443
 *             'params_dict': map_params_dict, 'flat_params': res[0], 'param_keys': keys,
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *             'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *             'param_guess_range':flat_guess_range,
 *             'scaled_param_guesses':scaled_guesses,
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 441, __pyx_L1_error)

  /* "pyross/inference.pyx":444
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *             'is_scale_parameter':is_scale_parameter,
 *             'param_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *             'scaled_param_guesses':scaled_guesses,
 *             'prior': prior
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 441, __pyx_L1_error)

  /* "pyross/inference.pyx":445
 *             'is_scale_parameter':is_scale_parameter,
 *             'param_guess_range':flat_guess_range,
 *             'scaled_param_guesses':scaled_guesses,             # <<<<<<<<<<<<<<
 *             'prior': prior
 *         }
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 441, __pyx_L1_error)

  /* "pyross/inference.pyx":446
 *             'param_guess_range':flat_guess_range,
 *             'scaled_param_guesses':scaled_guesses,
 *             'prior': prior             # <<<<<<<<<<<<<<
 *         }
 *         if map_control_params_dict != {}:
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  __pyx_v_output_dict = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":448
 *             'prior': prior
 *         }
 *         if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *             output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
  __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_map_control_params_dict, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_13) {

    /* "pyross/inference.pyx":449
 *         }
 *         if map_control_params_dict != {}:
 *             output_dict['control_params_dict'] = map_control_params_dict             # <<<<<<<<<<<<<<
 * 
 *         return output_dict
 */
    if (unlikely(PyDict_SetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict, __pyx_v_map_control_params_dict) < 0)) __PYX_ERR(0, 449, __pyx_L1_error)

    /* "pyross/inference.pyx":448
 *             'prior': prior
 *         }
 *         if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *             output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
  }

  /* "pyross/inference.pyx":451
 *             output_dict['control_params_dict'] = map_control_params_dict
 * 
 *         return output_dict             # <<<<<<<<<<<<<<
 * 
 *     def _nested_sampling_prior_transform(self, x, prior=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_dict);
  __pyx_r = __pyx_v_output_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":304
 *         return -self._logposterior(params, **logp_kwargs)
 * 
 *     def infer(self, x, Tf, prior_dict, contactMatrix=None,             # <<<<<<<<<<<<<<
 *               generator=None, intervention_fun=None, tangent=False,
 *               verbose=False, ftol=1e-6,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_flat_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_guesses);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_cma_stds);
  __Pyx_XDECREF(__pyx_v_minimize_args);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":453
 *         return output_dict
 * 
 *     def _nested_sampling_prior_transform(self, x, prior=None):             # <<<<<<<<<<<<<<
 *         return prior.ppf(x)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_23_nested_sampling_prior_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_23_nested_sampling_prior_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_prior = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_nested_sampling_prior_transform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_prior,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_nested_sampling_prior_transform") < 0)) __PYX_ERR(0, 453, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_prior = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_nested_sampling_prior_transform", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._nested_sampling_prior_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_22_nested_sampling_prior_transform(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_prior);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_22_nested_sampling_prior_transform(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_prior) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_nested_sampling_prior_transform", 0);

  /* "pyross/inference.pyx":454
 * 
 *     def _nested_sampling_prior_transform(self, x, prior=None):
 *         return prior.ppf(x)             # <<<<<<<<<<<<<<
 * 
 *     def infer_nested_sampling(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_ppf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_x);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":453
 *         return output_dict
 * 
 *     def _nested_sampling_prior_transform(self, x, prior=None):             # <<<<<<<<<<<<<<
 *         return prior.ppf(x)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SIR_type._nested_sampling_prior_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":456
 *         return prior.ppf(x)
 * 
 *     def infer_nested_sampling(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                               verbose=False, nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                               n_effective=None, add_live=True, sampler=None, **dynesty_args):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_25infer_nested_sampling(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_24infer_nested_sampling[] = "\n        Compute the log-evidence and weighted samples of the a-posteriori distribution of the parameters of a SIR type model\n        using nested sampling as implemented in the `dynesty` Python package. This function assumes that full data on\n        all classes is available.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        prior_dict: dict\n            A dictionary containing priors for parameters (can include both model and intervention parameters). See examples.\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is false.\n        verbose: bool, optional\n            Set to True to see intermediate outputs from the nested sampling procedure.\n        nprocesses: int, optional\n            The number of processes u""sed for parallel evaluation of the likelihood.\n        queue_size: int, optional\n            Size of internal queue of likelihood values, default is nprocesses if multiprocessing is used.\n        maxiter: int, optional\n            The maximum number of iterations. Default is no limit.\n        maxcall:int, optional\n            The maximum number of calls to the likelihood function. Default no limit.\n        dlogz: float, optional\n            The iteration terminates if the estimated contribution of the remaining prior volume to the total evidence\n            falls below this threshold. Default value is `1e-3 * (nlive - 1) + 0.01` if `add_live==True`, 0.01 otherwise.\n        n_effective: float, optional\n            The iteration terminates if the number of effective posterior samples reaches this values. Default is no limit.\n        add_live: bool, optional\n            Determines whether to add the remaining set of live points to the set of samples. Default is True.\n        sampler: dynesty.NestedSampler, optional\n            Continue running an instance of a nested sampler until the termination criteria are met.\n        **dynesty_args:\n            Arguments passed through to the construction of the dynesty.NestedSampler constructor. Relevant entries\n            are (this is not comprehensive, for details see the documentation of dynesty):\n\n            nlive: int, optional\n                The number of live points. Default is 500.\n            bound: {'none', 'single', 'multi', 'balls', 'cubes'}, optional\n                Method used to approximately bound the prior using the current set of live points. Default is 'multi'.\n            sample:  {'auto', 'unif', 'rwalk', 'rstagger', 'slice', 'rslice', 'hslice', callable}, optional\n                Method used to sample uniformly within the likelihood constraint, conditioned on the provided bounds.\n\n        Returns\n        -------\n        sampler: dynesty.NestedSampler\n            The state of ""the sampler after termination of the nested sampling run.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_25infer_nested_sampling(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_v_queue_size = 0;
  PyObject *__pyx_v_maxiter = 0;
  PyObject *__pyx_v_maxcall = 0;
  PyObject *__pyx_v_dlogz = 0;
  PyObject *__pyx_v_n_effective = 0;
  PyObject *__pyx_v_add_live = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_dynesty_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer_nested_sampling (wrapper)", 0);
  __pyx_v_dynesty_args = PyDict_New(); if (unlikely(!__pyx_v_dynesty_args)) return NULL;
  __Pyx_GOTREF(__pyx_v_dynesty_args);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_prior_dict,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_nprocesses,&__pyx_n_s_queue_size,&__pyx_n_s_maxiter,&__pyx_n_s_maxcall,&__pyx_n_s_dlogz,&__pyx_n_s_n_effective,&__pyx_n_s_add_live,&__pyx_n_s_sampler,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_False);

    /* "pyross/inference.pyx":457
 * 
 *     def infer_nested_sampling(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,
 *                               verbose=False, nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,             # <<<<<<<<<<<<<<
 *                               n_effective=None, add_live=True, sampler=None, **dynesty_args):
 *         """
 */
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)__pyx_int_0);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":458
 *     def infer_nested_sampling(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,
 *                               verbose=False, nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                               n_effective=None, add_live=True, sampler=None, **dynesty_args):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the log-evidence and weighted samples of the a-posteriori distribution of the parameters of a SIR type model
 */
    values[13] = ((PyObject *)Py_None);
    values[14] = ((PyObject *)Py_True);
    values[15] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_nested_sampling", 0, 3, 16, 1); __PYX_ERR(0, 456, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_nested_sampling", 0, 3, 16, 2); __PYX_ERR(0, 456, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_size);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxiter);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxcall);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dlogz);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_effective);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_add_live);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[15] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_dynesty_args, values, pos_args, "infer_nested_sampling") < 0)) __PYX_ERR(0, 456, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_prior_dict = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_verbose = values[7];
    __pyx_v_nprocesses = values[8];
    __pyx_v_queue_size = values[9];
    __pyx_v_maxiter = values[10];
    __pyx_v_maxcall = values[11];
    __pyx_v_dlogz = values[12];
    __pyx_v_n_effective = values[13];
    __pyx_v_add_live = values[14];
    __pyx_v_sampler = values[15];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer_nested_sampling", 0, 3, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 456, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_dynesty_args); __pyx_v_dynesty_args = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_nested_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_24infer_nested_sampling(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_prior_dict, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_nprocesses, __pyx_v_queue_size, __pyx_v_maxiter, __pyx_v_maxcall, __pyx_v_dlogz, __pyx_v_n_effective, __pyx_v_add_live, __pyx_v_sampler, __pyx_v_dynesty_args);

  /* "pyross/inference.pyx":456
 *         return prior.ppf(x)
 * 
 *     def infer_nested_sampling(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                               verbose=False, nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                               n_effective=None, add_live=True, sampler=None, **dynesty_args):
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_dynesty_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_24infer_nested_sampling(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args) {
  PyObject *__pyx_v_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_flat_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_guesses = NULL;
  PyObject *__pyx_v_prior = NULL;
  Py_ssize_t __pyx_v_ndim;
  PyObject *__pyx_v_prior_transform_args = NULL;
  PyObject *__pyx_v_loglike_args = NULL;
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  __Pyx_RefNannySetupContext("infer_nested_sampling", 0);
  __Pyx_INCREF(__pyx_v_nprocesses);
  __Pyx_INCREF(__pyx_v_queue_size);
  __Pyx_INCREF(__pyx_v_sampler);

  /* "pyross/inference.pyx":523
 *             The state of the sampler after termination of the nested sampling run.
 *         """
 *         if dynesty is None:             # <<<<<<<<<<<<<<
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dynesty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":524
 *         """
 *         if dynesty is None:
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses == 0:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 524, __pyx_L1_error)

    /* "pyross/inference.pyx":523
 *             The state of the sampler after termination of the nested sampling run.
 *         """
 *         if dynesty is None:             # <<<<<<<<<<<<<<
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 */
  }

  /* "pyross/inference.pyx":526
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_nprocesses, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":527
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 527, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":529
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()             # <<<<<<<<<<<<<<
 *             else:
 *                 nprocesses = 1
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":527
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":531
 *                 nprocesses = pathos_mp.cpu_count()
 *             else:
 *                 nprocesses = 1             # <<<<<<<<<<<<<<
 * 
 *         if queue_size is None:
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_int_1);
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":526
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  }

  /* "pyross/inference.pyx":533
 *                 nprocesses = 1
 * 
 *         if queue_size is None:             # <<<<<<<<<<<<<<
 *             queue_size = nprocesses
 * 
 */
  __pyx_t_3 = (__pyx_v_queue_size == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":534
 * 
 *         if queue_size is None:
 *             queue_size = nprocesses             # <<<<<<<<<<<<<<
 * 
 *         # Sanity checks of the intputs
 */
    __Pyx_INCREF(__pyx_v_nprocesses);
    __Pyx_DECREF_SET(__pyx_v_queue_size, __pyx_v_nprocesses);

    /* "pyross/inference.pyx":533
 *                 nprocesses = 1
 * 
 *         if queue_size is None:             # <<<<<<<<<<<<<<
 *             queue_size = nprocesses
 * 
 */
  }

  /* "pyross/inference.pyx":537
 * 
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":542
 *         prior_names, keys, guess, stds, bounds, \
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_check_length, __pyx_t_4) < 0) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 540, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_12);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_7,&__pyx_t_1,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 540, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_7,&__pyx_t_1,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
    __pyx_t_13 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 8) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 540, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }

  /* "pyross/inference.pyx":540
 * 
 *         # Read in parameter priors
 *         prior_names, keys, guess, stds, bounds, \             # <<<<<<<<<<<<<<
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_prior_names = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_keys = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_stds = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_bounds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_flat_guess_range = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_scaled_guesses = __pyx_t_12;
  __pyx_t_12 = 0;

  /* "pyross/inference.pyx":543
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         ndim = len(guess)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_Prior); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_12)) {
    PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
    PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_11) {
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL;
    }
    __Pyx_INCREF(__pyx_v_prior_names);
    __Pyx_GIVEREF(__pyx_v_prior_names);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_6, __pyx_v_prior_names);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_6, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_6, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_6, __pyx_v_stds);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_prior = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":545
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 *         ndim = len(guess)             # <<<<<<<<<<<<<<
 *         prior_transform_args = {'prior':prior}
 *         loglike_args = {'keys':keys, 'x':x, 'Tf':Tf, 'flat_guess_range':flat_guess_range,
 */
  __pyx_t_15 = PyObject_Length(__pyx_v_guess); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 545, __pyx_L1_error)
  __pyx_v_ndim = __pyx_t_15;

  /* "pyross/inference.pyx":546
 * 
 *         ndim = len(guess)
 *         prior_transform_args = {'prior':prior}             # <<<<<<<<<<<<<<
 *         loglike_args = {'keys':keys, 'x':x, 'Tf':Tf, 'flat_guess_range':flat_guess_range,
 *                          'is_scale_parameter':is_scale_parameter, 'scaled_guesses': scaled_guesses,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
  __pyx_v_prior_transform_args = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":547
 *         ndim = len(guess)
 *         prior_transform_args = {'prior':prior}
 *         loglike_args = {'keys':keys, 'x':x, 'Tf':Tf, 'flat_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *                          'is_scale_parameter':is_scale_parameter, 'scaled_guesses': scaled_guesses,
 *                          'generator':generator, 'intervention_fun': intervention_fun, 'tangent': tangent}
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_x, __pyx_v_x) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_flat_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 547, __pyx_L1_error)

  /* "pyross/inference.pyx":548
 *         prior_transform_args = {'prior':prior}
 *         loglike_args = {'keys':keys, 'x':x, 'Tf':Tf, 'flat_guess_range':flat_guess_range,
 *                          'is_scale_parameter':is_scale_parameter, 'scaled_guesses': scaled_guesses,             # <<<<<<<<<<<<<<
 *                          'generator':generator, 'intervention_fun': intervention_fun, 'tangent': tangent}
 * 
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_scaled_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 547, __pyx_L1_error)

  /* "pyross/inference.pyx":549
 *         loglike_args = {'keys':keys, 'x':x, 'Tf':Tf, 'flat_guess_range':flat_guess_range,
 *                          'is_scale_parameter':is_scale_parameter, 'scaled_guesses': scaled_guesses,
 *                          'generator':generator, 'intervention_fun': intervention_fun, 'tangent': tangent}             # <<<<<<<<<<<<<<
 * 
 *         if sampler is None:
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  __pyx_v_loglike_args = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":551
 *                          'generator':generator, 'intervention_fun': intervention_fun, 'tangent': tangent}
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 */
  __pyx_t_2 = (__pyx_v_sampler == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":552
 * 
 *         if sampler is None:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 552, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":553
 *         if sampler is None:
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 553, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 553, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_12, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_v_pool = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyross/inference.pyx":554
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_dynesty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_NestedSampler); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglikelihood); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nested_sampling_prior_transform); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
      __pyx_t_4 = 0;
      __pyx_t_12 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_ndim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ndim, __pyx_t_9) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pyross/inference.pyx":555
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,             # <<<<<<<<<<<<<<
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 *             else:
 */
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_logl_kwargs, __pyx_v_loglike_args) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ptform_kwargs, __pyx_v_prior_transform_args) < 0) __PYX_ERR(0, 554, __pyx_L1_error)

      /* "pyross/inference.pyx":556
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)             # <<<<<<<<<<<<<<
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 */
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_pool, __pyx_v_pool) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_queue_size, __pyx_v_queue_size) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
      __pyx_t_12 = __pyx_t_4;
      __pyx_t_4 = 0;
      if (__Pyx_MergeKeywords(__pyx_t_12, __pyx_v_dynesty_args) < 0) __PYX_ERR(0, 556, __pyx_L1_error)

      /* "pyross/inference.pyx":554
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyross/inference.pyx":552
 * 
 *         if sampler is None:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 */
      goto __pyx_L10;
    }

    /* "pyross/inference.pyx":558
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 **dynesty_args)
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_dynesty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_NestedSampler); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglikelihood); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nested_sampling_prior_transform); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
      __pyx_t_4 = 0;
      __pyx_t_11 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_ndim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ndim, __pyx_t_9) < 0) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pyross/inference.pyx":559
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,             # <<<<<<<<<<<<<<
 *                                                 **dynesty_args)
 *         else:
 */
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_logl_kwargs, __pyx_v_loglike_args) < 0) __PYX_ERR(0, 558, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ptform_kwargs, __pyx_v_prior_transform_args) < 0) __PYX_ERR(0, 558, __pyx_L1_error)
      __pyx_t_11 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyross/inference.pyx":560
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 **dynesty_args)             # <<<<<<<<<<<<<<
 *         else:
 *             if nprocesses > 1:
 */
      if (__Pyx_MergeKeywords(__pyx_t_11, __pyx_v_dynesty_args) < 0) __PYX_ERR(0, 560, __pyx_L1_error)

      /* "pyross/inference.pyx":558
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 **dynesty_args)
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L10:;

    /* "pyross/inference.pyx":551
 *                          'generator':generator, 'intervention_fun': intervention_fun, 'tangent': tangent}
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 */
    goto __pyx_L9;
  }

  /* "pyross/inference.pyx":562
 *                                                 **dynesty_args)
 *         else:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 */
  /*else*/ {
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":564
 *             if nprocesses > 1:
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_4 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, __pyx_t_4) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pyross/inference.pyx":565
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler.M = sampler.pool.map             # <<<<<<<<<<<<<<
 *             elif sampler.pool is not None:
 *                 sampler.pool = None
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_map); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_M, __pyx_t_10) < 0) __PYX_ERR(0, 565, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "pyross/inference.pyx":562
 *                                                 **dynesty_args)
 *         else:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 */
      goto __pyx_L11;
    }

    /* "pyross/inference.pyx":566
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 sampler.pool = None
 *                 sampler.M = map
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = (__pyx_t_10 != Py_None);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "pyross/inference.pyx":567
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:
 *                 sampler.pool = None             # <<<<<<<<<<<<<<
 *                 sampler.M = map
 * 
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, Py_None) < 0) __PYX_ERR(0, 567, __pyx_L1_error)

      /* "pyross/inference.pyx":568
 *             elif sampler.pool is not None:
 *                 sampler.pool = None
 *                 sampler.M = map             # <<<<<<<<<<<<<<
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_M, __pyx_builtin_map) < 0) __PYX_ERR(0, 568, __pyx_L1_error)

      /* "pyross/inference.pyx":566
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 sampler.pool = None
 *                 sampler.M = map
 */
    }
    __pyx_L11:;
  }
  __pyx_L9:;

  /* "pyross/inference.pyx":570
 *                 sampler.M = map
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,             # <<<<<<<<<<<<<<
 *                            add_live=add_live, print_progress=verbose)
 * 
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_run_nested); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxiter, __pyx_v_maxiter) < 0) __PYX_ERR(0, 570, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxcall, __pyx_v_maxcall) < 0) __PYX_ERR(0, 570, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dlogz, __pyx_v_dlogz) < 0) __PYX_ERR(0, 570, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_effective, __pyx_v_n_effective) < 0) __PYX_ERR(0, 570, __pyx_L1_error)

  /* "pyross/inference.pyx":571
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,
 *                            add_live=add_live, print_progress=verbose)             # <<<<<<<<<<<<<<
 * 
 *         if sampler.pool is not None:
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_add_live, __pyx_v_add_live) < 0) __PYX_ERR(0, 570, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_print_progress, __pyx_v_verbose) < 0) __PYX_ERR(0, 570, __pyx_L1_error)

  /* "pyross/inference.pyx":570
 *                 sampler.M = map
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,             # <<<<<<<<<<<<<<
 *                            add_live=add_live, print_progress=verbose)
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pyross/inference.pyx":573
 *                            add_live=add_live, print_progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_2 = (__pyx_t_11 != Py_None);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":574
 * 
 *         if sampler.pool is not None:
 *             sampler.pool.close()             # <<<<<<<<<<<<<<
 *             sampler.pool.join()
 *             sampler.pool.clear()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":575
 *         if sampler.pool is not None:
 *             sampler.pool.close()
 *             sampler.pool.join()             # <<<<<<<<<<<<<<
 *             sampler.pool.clear()
 * 
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_join); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_11 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":576
 *             sampler.pool.close()
 *             sampler.pool.join()
 *             sampler.pool.clear()             # <<<<<<<<<<<<<<
 * 
 *         return sampler
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_clear); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":573
 *                            add_live=add_live, print_progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  }

  /* "pyross/inference.pyx":578
 *             sampler.pool.clear()
 * 
 *         return sampler             # <<<<<<<<<<<<<<
 * 
 *     def infer_nested_sampling_process_result(self, sampler, prior_dict,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sampler);
  __pyx_r = __pyx_v_sampler;
  goto __pyx_L0;

  /* "pyross/inference.pyx":456
 *         return prior.ppf(x)
 * 
 *     def infer_nested_sampling(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                               verbose=False, nprocesses=0, queue_size=None, maxiter=None, maxcall=None, dlogz=None,
 *                               n_effective=None, add_live=True, sampler=None, **dynesty_args):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_nested_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_flat_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_guesses);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_prior_transform_args);
  __Pyx_XDECREF(__pyx_v_loglike_args);
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XDECREF(__pyx_v_nprocesses);
  __Pyx_XDECREF(__pyx_v_queue_size);
  __Pyx_XDECREF(__pyx_v_sampler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":580
 *         return sampler
 * 
 *     def infer_nested_sampling_process_result(self, sampler, prior_dict,             # <<<<<<<<<<<<<<
 *                                              contactMatrix=None, generator=None,
 *                                              intervention_fun=None, **catchall_kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_27infer_nested_sampling_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_26infer_nested_sampling_process_result[] = "\n        Take the sampler generated by `pyross.inference.infer_nested_sampling` and produce output dictionaries for\n        further use in the pyross framework. See `pyross.inference.infer_nested_sampling` for description of parameters.\n\n        Parameters\n        ----------\n        sampler: dynesty.NestedSampler\n            The output of `pyross.inference.infer_nested_sampling`.\n        prior_dict: dict\n        contactMatrix: callable, optional\n        generator: pyross.contactMatrix, optional\n        intervention_fun: callable, optional\n        **catchall_kwargs: dict\n            Catched further provided arguments and ignores them.\n\n        Returns\n        -------\n        result: dynesty.Result\n            The result of the nested sampling iteration. Relevant entries include:\n\n            result.logz: list\n                The progression of log-evidence estimates, use result.logz[-1] for the final estimate.\n        output_samples: list\n            The processed weighted posterior samples.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_27infer_nested_sampling_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer_nested_sampling_process_result (wrapper)", 0);
  __pyx_v_catchall_kwargs = PyDict_New(); if (unlikely(!__pyx_v_catchall_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_catchall_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_prior_dict,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "pyross/inference.pyx":581
 * 
 *     def infer_nested_sampling_process_result(self, sampler, prior_dict,
 *                                              contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                                              intervention_fun=None, **catchall_kwargs):
 *         """
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":582
 *     def infer_nested_sampling_process_result(self, sampler, prior_dict,
 *                                              contactMatrix=None, generator=None,
 *                                              intervention_fun=None, **catchall_kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `pyross.inference.infer_nested_sampling` and produce output dictionaries for
 */
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_nested_sampling_process_result", 0, 2, 5, 1); __PYX_ERR(0, 580, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_catchall_kwargs, values, pos_args, "infer_nested_sampling_process_result") < 0)) __PYX_ERR(0, 580, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sampler = values[0];
    __pyx_v_prior_dict = values[1];
    __pyx_v_contactMatrix = values[2];
    __pyx_v_generator = values[3];
    __pyx_v_intervention_fun = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer_nested_sampling_process_result", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 580, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_catchall_kwargs); __pyx_v_catchall_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_nested_sampling_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_26infer_nested_sampling_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_prior_dict, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_catchall_kwargs);

  /* "pyross/inference.pyx":580
 *         return sampler
 * 
 *     def infer_nested_sampling_process_result(self, sampler, prior_dict,             # <<<<<<<<<<<<<<
 *                                              contactMatrix=None, generator=None,
 *                                              intervention_fun=None, **catchall_kwargs):
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_catchall_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_26infer_nested_sampling_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs) {
  PyObject *__pyx_v_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_flat_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_guesses = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_output_samples = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_v_weight = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  __Pyx_RefNannySetupContext("infer_nested_sampling_process_result", 0);

  /* "pyross/inference.pyx":608
 *             The processed weighted posterior samples.
 *         """
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":610
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_check_length, __pyx_t_3) < 0) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 609, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 609, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
    __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 8) < 0) __PYX_ERR(0, 609, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 609, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "pyross/inference.pyx":609
 *         """
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)
 */
  __pyx_v_prior_names = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_keys = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_bounds = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_flat_guess_range = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_scaled_guesses = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":611
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         result = sampler.results
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_prior_names);
    __Pyx_GIVEREF(__pyx_v_prior_names);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_v_prior_names);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_prior = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":613
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 *         result = sampler.results             # <<<<<<<<<<<<<<
 *         output_samples = []
 *         for i in range(len(result.samples)):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_results); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":614
 * 
 *         result = sampler.results
 *         output_samples = []             # <<<<<<<<<<<<<<
 *         for i in range(len(result.samples)):
 *             sample = result.samples[i]
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_output_samples = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":615
 *         result = sampler.results
 *         output_samples = []
 *         for i in range(len(result.samples)):             # <<<<<<<<<<<<<<
 *             sample = result.samples[i]
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_13 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_14 = __pyx_t_13;
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
    __pyx_v_i = __pyx_t_15;

    /* "pyross/inference.pyx":616
 *         output_samples = []
 *         for i in range(len(result.samples)):
 *             sample = result.samples[i]             # <<<<<<<<<<<<<<
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])
 *             l_like = result.logl[i]
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":617
 *         for i in range(len(result.samples)):
 *             sample = result.samples[i]
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])             # <<<<<<<<<<<<<<
 *             l_like = result.logl[i]
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exp); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logwt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_16 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_17 = (__pyx_t_16 - 1);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_17, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_10 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_weight, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":618
 *             sample = result.samples[i]
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])
 *             l_like = result.logl[i]             # <<<<<<<<<<<<<<
 * 
 *             orig_params = pyross.utils.unflatten_parameters(sample, flat_guess_range,
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logl); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_10, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_like, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":620
 *             l_like = result.logl[i]
 * 
 *             orig_params = pyross.utils.unflatten_parameters(sample, flat_guess_range,             # <<<<<<<<<<<<<<
 *                                                             is_scale_parameter, scaled_guesses)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pyross); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":621
 * 
 *             orig_params = pyross.utils.unflatten_parameters(sample, flat_guess_range,
 *                                                             is_scale_parameter, scaled_guesses)             # <<<<<<<<<<<<<<
 * 
 *             map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 */
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_sample, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_8);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_sample, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_8);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_sample);
      __Pyx_GIVEREF(__pyx_v_sample);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_4, __pyx_v_sample);
      __Pyx_INCREF(__pyx_v_flat_guess_range);
      __Pyx_GIVEREF(__pyx_v_flat_guess_range);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_4, __pyx_v_flat_guess_range);
      __Pyx_INCREF(__pyx_v_is_scale_parameter);
      __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
      __Pyx_INCREF(__pyx_v_scaled_guesses);
      __Pyx_GIVEREF(__pyx_v_scaled_guesses);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_4, __pyx_v_scaled_guesses);
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_orig_params, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":623
 *                                                             is_scale_parameter, scaled_guesses)
 * 
 *             map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *             self.set_params(map_params_dict)
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v_keys);
    __Pyx_GIVEREF(__pyx_v_keys);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_keys);
    __Pyx_INCREF(__pyx_v_orig_params);
    __Pyx_GIVEREF(__pyx_v_orig_params);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_orig_params);
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 623, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 623, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_8); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_8), 2) < 0) __PYX_ERR(0, 623, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 623, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_map_params_dict, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_map_control_params_dict, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":624
 * 
 *             map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 *             self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *             if generator is not None:
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_7, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_map_params_dict);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":626
 *             self.set_params(map_params_dict)
 * 
 *             if generator is not None:             # <<<<<<<<<<<<<<
 *                 if intervention_fun is None:
 *                     self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
    __pyx_t_18 = (__pyx_v_generator != Py_None);
    __pyx_t_19 = (__pyx_t_18 != 0);
    if (__pyx_t_19) {

      /* "pyross/inference.pyx":627
 * 
 *             if generator is not None:
 *                 if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                     self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *                 else:
 */
      __pyx_t_19 = (__pyx_v_intervention_fun == Py_None);
      __pyx_t_18 = (__pyx_t_19 != 0);
      if (__pyx_t_18) {

        /* "pyross/inference.pyx":628
 *             if generator is not None:
 *                 if intervention_fun is None:
 *                     self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 628, __pyx_L1_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
          __pyx_t_10 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
        } else {
          __pyx_t_10 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
        }
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_v_self->contactMatrix);
        __Pyx_DECREF(__pyx_v_self->contactMatrix);
        __pyx_v_self->contactMatrix = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pyross/inference.pyx":627
 * 
 *             if generator is not None:
 *                 if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                     self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *                 else:
 */
        goto __pyx_L10;
      }

      /* "pyross/inference.pyx":630
 *                     self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *                 else:
 *                     self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *             l_prior = np.sum(prior.logpdf(sample))
 */
      /*else*/ {
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 630, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 630, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_v_intervention_fun);
        __Pyx_GIVEREF(__pyx_v_intervention_fun);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_intervention_fun);
        if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 630, __pyx_L1_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
          __pyx_t_3 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 630, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_v_self->contactMatrix);
        __Pyx_DECREF(__pyx_v_self->contactMatrix);
        __pyx_v_self->contactMatrix = __pyx_t_8;
        __pyx_t_8 = 0;
      }
      __pyx_L10:;

      /* "pyross/inference.pyx":626
 *             self.set_params(map_params_dict)
 * 
 *             if generator is not None:             # <<<<<<<<<<<<<<
 *                 if intervention_fun is None:
 *                     self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
    }

    /* "pyross/inference.pyx":632
 *                     self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *             l_prior = np.sum(prior.logpdf(sample))             # <<<<<<<<<<<<<<
 *             l_post = l_like + l_prior
 *             output_dict = {
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_v_sample) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_sample);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_prior, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":633
 * 
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior             # <<<<<<<<<<<<<<
 *             output_dict = {
 *                 'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,
 */
    __pyx_t_8 = PyNumber_Add(__pyx_v_l_like, __pyx_v_l_prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":635
 *             l_post = l_like + l_prior
 *             output_dict = {
 *                 'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,             # <<<<<<<<<<<<<<
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                 'weight':weight, 'is_scale_parameter':is_scale_parameter,
 */
    __pyx_t_8 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 635, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_params_dict, __pyx_v_map_params_dict) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_flat_params, __pyx_v_sample) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 635, __pyx_L1_error)

    /* "pyross/inference.pyx":636
 *             output_dict = {
 *                 'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,             # <<<<<<<<<<<<<<
 *                 'weight':weight, 'is_scale_parameter':is_scale_parameter,
 *                 'param_guess_range':flat_guess_range,
 */
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0) __PYX_ERR(0, 635, __pyx_L1_error)

    /* "pyross/inference.pyx":637
 *                 'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                 'weight':weight, 'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                 'param_guess_range':flat_guess_range,
 *                 'scaled_param_guesses':scaled_guesses,
 */
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_weight, __pyx_v_weight) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 635, __pyx_L1_error)

    /* "pyross/inference.pyx":638
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                 'weight':weight, 'is_scale_parameter':is_scale_parameter,
 *                 'param_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *                 'scaled_param_guesses':scaled_guesses,
 *                 'prior': prior
 */
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_param_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 635, __pyx_L1_error)

    /* "pyross/inference.pyx":639
 *                 'weight':weight, 'is_scale_parameter':is_scale_parameter,
 *                 'param_guess_range':flat_guess_range,
 *                 'scaled_param_guesses':scaled_guesses,             # <<<<<<<<<<<<<<
 *                 'prior': prior
 *             }
 */
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 635, __pyx_L1_error)

    /* "pyross/inference.pyx":640
 *                 'param_guess_range':flat_guess_range,
 *                 'scaled_param_guesses':scaled_guesses,
 *                 'prior': prior             # <<<<<<<<<<<<<<
 *             }
 *             if map_control_params_dict != {}:
 */
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_output_dict, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":642
 *                 'prior': prior
 *             }
 *             if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                 output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
    __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_map_control_params_dict, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_18) {

      /* "pyross/inference.pyx":643
 *             }
 *             if map_control_params_dict != {}:
 *                 output_dict['control_params_dict'] = map_control_params_dict             # <<<<<<<<<<<<<<
 * 
 *             output_samples.append(output_dict)
 */
      if (unlikely(PyDict_SetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict, __pyx_v_map_control_params_dict) < 0)) __PYX_ERR(0, 643, __pyx_L1_error)

      /* "pyross/inference.pyx":642
 *                 'prior': prior
 *             }
 *             if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                 output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
    }

    /* "pyross/inference.pyx":645
 *                 output_dict['control_params_dict'] = map_control_params_dict
 * 
 *             output_samples.append(output_dict)             # <<<<<<<<<<<<<<
 * 
 *         return result, output_samples
 */
    __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_output_samples, __pyx_v_output_dict); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 645, __pyx_L1_error)
  }

  /* "pyross/inference.pyx":647
 *             output_samples.append(output_dict)
 * 
 *         return result, output_samples             # <<<<<<<<<<<<<<
 * 
 *     def infer_mcmc(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_result);
  __Pyx_GIVEREF(__pyx_v_result);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_result);
  __Pyx_INCREF(__pyx_v_output_samples);
  __Pyx_GIVEREF(__pyx_v_output_samples);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_output_samples);
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":580
 *         return sampler
 * 
 *     def infer_nested_sampling_process_result(self, sampler, prior_dict,             # <<<<<<<<<<<<<<
 *                                              contactMatrix=None, generator=None,
 *                                              intervention_fun=None, **catchall_kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_nested_sampling_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_flat_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_guesses);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XDECREF(__pyx_v_weight);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":649
 *         return result, output_samples
 * 
 *     def infer_mcmc(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                    verbose=False, sampler=None, nwalkers=None, walker_pos=None, nsamples=1000, nprocesses=0):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_29infer_mcmc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_28infer_mcmc[] = "\n        Sample the posterior distribution of the epidemiological parameters using ensemble MCMC.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        prior_dict: dict\n            A dictionary containing priors for parameters (can include both model and intervention parameters). See examples.\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        verbose: bool, optional\n            Set to True to see a progress bar for the sample generation. Default is False.\n        sampler: emcee.EnsembleSampler, optional\n            Set to instance of the sampler (as returned by this function) to continue running the MCMC chains.\n            Default is None (i.e. run a new chain).\n        nwalkers:int, optional\n    ""        The number of chains in the ensemble (should be at least 2*dim). Default is 2*dim.\n        walker_pos: np.array, optional\n            The initial position of the walkers. If not specified, it samples random positions from the prior.\n        nsamples:int, optional\n            The number of samples per walker. Default is 1000.\n        nprocesses: int, optional\n            The number of processes used to compute the likelihood for the walkers, needs `pathos`. Default is\n            the number of cpu cores if `pathos` is available, otherwise 1.\n\n        Returns\n        -------\n        sampler: emcee.EnsembleSampler\n            This function returns the interal state of the sampler. To look at the chain of the internal flattened paramters,\n            run `sampler.get_chain()`. Use this to judge whether the chain has sufficiently converged. Either rerun\n            `mcmc_inference(..., sampler=sampler)` to continue the chain or `mcmc_inference_process_result(...)` to process\n            the result.\n\n        Examples\n        --------\n        For the structure of `prior_dict`, see the documentation of `infer`. To start sampling the posterior,\n        run for example\n\n        >>> sampler = estimator.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, verbose=True)\n\n        To judge the convergence of this chain, we can look at the trace plot of all the chains (for a moderate number of\n        dimensions `dim`)\n\n        >>> fig, axes = plt.subplots(dim, sharex=True)\n        >>> samples = sampler.get_chain()\n        >>> for i in range(dim):\n                ax = axes[i]\n                ax.plot(samples[:, :, i], \"k\", alpha=0.3)\n                ax.set_xlim(0, len(samples))\n        >>> axes[-1].set_xlabel(\"step number\");\n\n        For more detailed convergence metrics, see the documentation of `emcee`. To continue running this chain, we can\n        call this function again with the sampler as argument\n\n        >>> sampler = ""estimator.infer_mcmc(x, Tf, prior_dict, contactMatrix=contactMatrix, verbose=True, sampler=sampler)\n\n        This procudes 1000 additional samples in each chain. To process the results, call `infer_mcmc_process_result`.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_29infer_mcmc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_nwalkers = 0;
  PyObject *__pyx_v_walker_pos = 0;
  PyObject *__pyx_v_nsamples = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer_mcmc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_prior_dict,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_sampler,&__pyx_n_s_nwalkers,&__pyx_n_s_walker_pos,&__pyx_n_s_nsamples,&__pyx_n_s_nprocesses,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_False);

    /* "pyross/inference.pyx":650
 * 
 *     def infer_mcmc(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,
 *                    verbose=False, sampler=None, nwalkers=None, walker_pos=None, nsamples=1000, nprocesses=0):             # <<<<<<<<<<<<<<
 *         """
 *         Sample the posterior distribution of the epidemiological parameters using ensemble MCMC.
 */
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)__pyx_int_1000);
    values[12] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_mcmc", 0, 3, 13, 1); __PYX_ERR(0, 649, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_mcmc", 0, 3, 13, 2); __PYX_ERR(0, 649, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nwalkers);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_walker_pos);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsamples);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "infer_mcmc") < 0)) __PYX_ERR(0, 649, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_prior_dict = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_verbose = values[7];
    __pyx_v_sampler = values[8];
    __pyx_v_nwalkers = values[9];
    __pyx_v_walker_pos = values[10];
    __pyx_v_nsamples = values[11];
    __pyx_v_nprocesses = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer_mcmc", 0, 3, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 649, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_mcmc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_28infer_mcmc(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_prior_dict, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_sampler, __pyx_v_nwalkers, __pyx_v_walker_pos, __pyx_v_nsamples, __pyx_v_nprocesses);

  /* "pyross/inference.pyx":649
 *         return result, output_samples
 * 
 *     def infer_mcmc(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                    verbose=False, sampler=None, nwalkers=None, walker_pos=None, nsamples=1000, nprocesses=0):
 *         """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_28infer_mcmc(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses) {
  PyObject *__pyx_v_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_flat_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_guesses = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_ndim = NULL;
  PyObject *__pyx_v_logpost_args = NULL;
  PyObject *__pyx_v_points = NULL;
  PyObject *__pyx_v_p0 = NULL;
  PyObject *__pyx_v_mcmc_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  Py_ssize_t __pyx_t_16;
  __Pyx_RefNannySetupContext("infer_mcmc", 0);
  __Pyx_INCREF(__pyx_v_sampler);
  __Pyx_INCREF(__pyx_v_nwalkers);
  __Pyx_INCREF(__pyx_v_nprocesses);

  /* "pyross/inference.pyx":726
 *         This procudes 1000 additional samples in each chain. To process the results, call `infer_mcmc_process_result`.
 *         """
 *         if emcee is None:             # <<<<<<<<<<<<<<
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_emcee); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":727
 *         """
 *         if emcee is None:
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses == 0:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 727, __pyx_L1_error)

    /* "pyross/inference.pyx":726
 *         This procudes 1000 additional samples in each chain. To process the results, call `infer_mcmc_process_result`.
 *         """
 *         if emcee is None:             # <<<<<<<<<<<<<<
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 */
  }

  /* "pyross/inference.pyx":729
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_nprocesses, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":730
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 730, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":732
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()             # <<<<<<<<<<<<<<
 *             else:
 *                 nprocesses = 1
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":730
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":734
 *                 nprocesses = pathos_mp.cpu_count()
 *             else:
 *                 nprocesses = 1             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses > 1 and pathos_mp is None:
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_int_1);
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":729
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  }

  /* "pyross/inference.pyx":736
 *                 nprocesses = 1
 * 
 *         if nprocesses > 1 and pathos_mp is None:             # <<<<<<<<<<<<<<
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_2 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L7_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":737
 * 
 *         if nprocesses > 1 and pathos_mp is None:
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")             # <<<<<<<<<<<<<<
 * 
 *         # Sanity checks of the intputs
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 737, __pyx_L1_error)

    /* "pyross/inference.pyx":736
 *                 nprocesses = 1
 * 
 *         if nprocesses > 1 and pathos_mp is None:             # <<<<<<<<<<<<<<
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")
 * 
 */
  }

  /* "pyross/inference.pyx":740
 * 
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":745
 *         prior_names, keys, guess, stds, bounds, \
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_check_length, __pyx_t_4) < 0) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 743, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_13);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_8,&__pyx_t_1,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 743, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_8,&__pyx_t_1,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13};
    __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_15(__pyx_t_14); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 8) < 0) __PYX_ERR(0, 743, __pyx_L1_error)
    __pyx_t_15 = NULL;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_15 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 743, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }

  /* "pyross/inference.pyx":743
 * 
 *         # Read in parameter priors
 *         prior_names, keys, guess, stds, bounds, \             # <<<<<<<<<<<<<<
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_prior_names = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_keys = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_stds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_bounds = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_flat_guess_range = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_12;
  __pyx_t_12 = 0;
  __pyx_v_scaled_guesses = __pyx_t_13;
  __pyx_t_13 = 0;

  /* "pyross/inference.pyx":746
 *         flat_guess_range, is_scale_parameter, scaled_guesses  \
 *                 = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         ndim = len(guess)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_Prior); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_13)) {
    PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
    PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_12) {
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL;
    }
    __Pyx_INCREF(__pyx_v_prior_names);
    __Pyx_GIVEREF(__pyx_v_prior_names);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_7, __pyx_v_prior_names);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_7, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_7, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_7, __pyx_v_stds);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_v_prior = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":748
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 *         ndim = len(guess)             # <<<<<<<<<<<<<<
 *         if nwalkers is None:
 *             nwalkers = 2*ndim
 */
  __pyx_t_16 = PyObject_Length(__pyx_v_guess); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 748, __pyx_L1_error)
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_ndim = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":749
 * 
 *         ndim = len(guess)
 *         if nwalkers is None:             # <<<<<<<<<<<<<<
 *             nwalkers = 2*ndim
 * 
 */
  __pyx_t_3 = (__pyx_v_nwalkers == Py_None);
  __pyx_t_6 = (__pyx_t_3 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":750
 *         ndim = len(guess)
 *         if nwalkers is None:
 *             nwalkers = 2*ndim             # <<<<<<<<<<<<<<
 * 
 *         logpost_args = {'bounds':bounds, 'keys':keys, 'is_scale_parameter':is_scale_parameter,
 */
    __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ndim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_nwalkers, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":749
 * 
 *         ndim = len(guess)
 *         if nwalkers is None:             # <<<<<<<<<<<<<<
 *             nwalkers = 2*ndim
 * 
 */
  }

  /* "pyross/inference.pyx":752
 *             nwalkers = 2*ndim
 * 
 *         logpost_args = {'bounds':bounds, 'keys':keys, 'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                 'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,
 *                 'x':x, 'Tf':Tf, 'prior':prior, 'tangent':tangent, 'generator':generator,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_bounds, __pyx_v_bounds) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 752, __pyx_L1_error)

  /* "pyross/inference.pyx":753
 * 
 *         logpost_args = {'bounds':bounds, 'keys':keys, 'is_scale_parameter':is_scale_parameter,
 *                 'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *                 'x':x, 'Tf':Tf, 'prior':prior, 'tangent':tangent, 'generator':generator,
 *                 'intervention_fun': intervention_fun}
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_scaled_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_flat_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 752, __pyx_L1_error)

  /* "pyross/inference.pyx":754
 *         logpost_args = {'bounds':bounds, 'keys':keys, 'is_scale_parameter':is_scale_parameter,
 *                 'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,
 *                 'x':x, 'Tf':Tf, 'prior':prior, 'tangent':tangent, 'generator':generator,             # <<<<<<<<<<<<<<
 *                 'intervention_fun': intervention_fun}
 *         if walker_pos is None:
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_x, __pyx_v_x) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 752, __pyx_L1_error)

  /* "pyross/inference.pyx":755
 *                 'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,
 *                 'x':x, 'Tf':Tf, 'prior':prior, 'tangent':tangent, 'generator':generator,
 *                 'intervention_fun': intervention_fun}             # <<<<<<<<<<<<<<
 *         if walker_pos is None:
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  __pyx_v_logpost_args = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":756
 *                 'x':x, 'Tf':Tf, 'prior':prior, 'tangent':tangent, 'generator':generator,
 *                 'intervention_fun': intervention_fun}
 *         if walker_pos is None:             # <<<<<<<<<<<<<<
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)
 */
  __pyx_t_6 = (__pyx_v_walker_pos == Py_None);
  __pyx_t_3 = (__pyx_t_6 != 0);
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":758
 *         if walker_pos is None:
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)             # <<<<<<<<<<<<<<
 *             p0 = prior.ppf(points)
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_random); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_rand); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_nwalkers, __pyx_v_ndim};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_nwalkers, __pyx_v_ndim};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_nwalkers);
      __Pyx_GIVEREF(__pyx_v_nwalkers);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_7, __pyx_v_nwalkers);
      __Pyx_INCREF(__pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_v_ndim);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_7, __pyx_v_ndim);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_points = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":759
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)
 *             p0 = prior.ppf(points)             # <<<<<<<<<<<<<<
 *         else:
 *             p0 = walker_pos
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_ppf); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_v_points) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_points);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_p0 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":756
 *                 'x':x, 'Tf':Tf, 'prior':prior, 'tangent':tangent, 'generator':generator,
 *                 'intervention_fun': intervention_fun}
 *         if walker_pos is None:             # <<<<<<<<<<<<<<
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)
 */
    goto __pyx_L12;
  }

  /* "pyross/inference.pyx":761
 *             p0 = prior.ppf(points)
 *         else:
 *             p0 = walker_pos             # <<<<<<<<<<<<<<
 * 
 *         if sampler is None:
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_walker_pos);
    __pyx_v_p0 = __pyx_v_walker_pos;
  }
  __pyx_L12:;

  /* "pyross/inference.pyx":763
 *             p0 = walker_pos
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:
 */
  __pyx_t_3 = (__pyx_v_sampler == Py_None);
  __pyx_t_6 = (__pyx_t_3 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":765
 *         if sampler is None:
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args,
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 765, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {

      /* "pyross/inference.pyx":766
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args,
 *                                                 pool=mcmc_pool)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_mcmc_pool = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyross/inference.pyx":767
 *             if nprocesses > 1:
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args,             # <<<<<<<<<<<<<<
 *                                                 pool=mcmc_pool)
 *             else:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_emcee); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_EnsembleSampler); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_nwalkers);
      __Pyx_GIVEREF(__pyx_v_nwalkers);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_nwalkers);
      __Pyx_INCREF(__pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_v_ndim);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_kwargs, __pyx_v_logpost_args) < 0) __PYX_ERR(0, 767, __pyx_L1_error)

      /* "pyross/inference.pyx":768
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args,
 *                                                 pool=mcmc_pool)             # <<<<<<<<<<<<<<
 *             else:
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args)
 */
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_pool, __pyx_v_mcmc_pool) < 0) __PYX_ERR(0, 767, __pyx_L1_error)

      /* "pyross/inference.pyx":767
 *             if nprocesses > 1:
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args,             # <<<<<<<<<<<<<<
 *                                                 pool=mcmc_pool)
 *             else:
 */
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "pyross/inference.pyx":765
 *         if sampler is None:
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args,
 */
      goto __pyx_L14;
    }

    /* "pyross/inference.pyx":770
 *                                                 pool=mcmc_pool)
 *             else:
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args)             # <<<<<<<<<<<<<<
 * 
 *             sampler.run_mcmc(p0, nsamples, progress=verbose)
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_emcee); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_EnsembleSampler); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_nwalkers);
      __Pyx_GIVEREF(__pyx_v_nwalkers);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_nwalkers);
      __Pyx_INCREF(__pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_v_ndim);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_kwargs, __pyx_v_logpost_args) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_12);
      __pyx_t_12 = 0;
    }
    __pyx_L14:;

    /* "pyross/inference.pyx":772
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior, kwargs=logpost_args)
 * 
 *             sampler.run_mcmc(p0, nsamples, progress=verbose)             # <<<<<<<<<<<<<<
 *         else:
 *             # Continue running an existing MCMC chain.
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_run_mcmc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_p0);
    __Pyx_GIVEREF(__pyx_v_p0);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_p0);
    __Pyx_INCREF(__pyx_v_nsamples);
    __Pyx_GIVEREF(__pyx_v_nsamples);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_nsamples);
    __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_progress, __pyx_v_verbose) < 0) __PYX_ERR(0, 772, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyross/inference.pyx":763
 *             p0 = walker_pos
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:
 */
    goto __pyx_L13;
  }

  /* "pyross/inference.pyx":775
 *         else:
 *             # Continue running an existing MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:
 */
  /*else*/ {
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {

      /* "pyross/inference.pyx":776
 *             # Continue running an existing MCMC chain.
 *             if nprocesses > 1:
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *             elif sampler.pool is not None:
 *                 sampler.pool = None
 */
      __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_13, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, __pyx_t_4) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pyross/inference.pyx":775
 *         else:
 *             # Continue running an existing MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:
 */
      goto __pyx_L15;
    }

    /* "pyross/inference.pyx":777
 *             if nprocesses > 1:
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 sampler.pool = None
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (__pyx_t_4 != Py_None);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = (__pyx_t_6 != 0);
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":778
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:
 *                 sampler.pool = None             # <<<<<<<<<<<<<<
 * 
 *             sampler.run_mcmc(None, nsamples, progress=verbose)
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, Py_None) < 0) __PYX_ERR(0, 778, __pyx_L1_error)

      /* "pyross/inference.pyx":777
 *             if nprocesses > 1:
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 sampler.pool = None
 * 
 */
    }
    __pyx_L15:;

    /* "pyross/inference.pyx":780
 *                 sampler.pool = None
 * 
 *             sampler.run_mcmc(None, nsamples, progress=verbose)             # <<<<<<<<<<<<<<
 * 
 *         if sampler.pool is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_run_mcmc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_11, 0, Py_None);
    __Pyx_INCREF(__pyx_v_nsamples);
    __Pyx_GIVEREF(__pyx_v_nsamples);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_nsamples);
    __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_progress, __pyx_v_verbose) < 0) __PYX_ERR(0, 780, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __pyx_L13:;

  /* "pyross/inference.pyx":782
 *             sampler.run_mcmc(None, nsamples, progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = (__pyx_t_12 != Py_None);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_6 = (__pyx_t_3 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":783
 * 
 *         if sampler.pool is not None:
 *             sampler.pool.close()             # <<<<<<<<<<<<<<
 *             sampler.pool.join()
 *             sampler.pool.clear()
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "pyross/inference.pyx":784
 *         if sampler.pool is not None:
 *             sampler.pool.close()
 *             sampler.pool.join()             # <<<<<<<<<<<<<<
 *             sampler.pool.clear()
 * 
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_join); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    __pyx_t_12 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "pyross/inference.pyx":785
 *             sampler.pool.close()
 *             sampler.pool.join()
 *             sampler.pool.clear()             # <<<<<<<<<<<<<<
 * 
 *         return sampler
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_clear); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "pyross/inference.pyx":782
 *             sampler.run_mcmc(None, nsamples, progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  }

  /* "pyross/inference.pyx":787
 *             sampler.pool.clear()
 * 
 *         return sampler             # <<<<<<<<<<<<<<
 * 
 *     def infer_mcmc_process_result(self, sampler, prior_dict, contactMatrix=None, generator=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sampler);
  __pyx_r = __pyx_v_sampler;
  goto __pyx_L0;

  /* "pyross/inference.pyx":649
 *         return result, output_samples
 * 
 *     def infer_mcmc(self, x, Tf, prior_dict, contactMatrix=None, generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                    verbose=False, sampler=None, nwalkers=None, walker_pos=None, nsamples=1000, nprocesses=0):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_mcmc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_flat_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_guesses);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_ndim);
  __Pyx_XDECREF(__pyx_v_logpost_args);
  __Pyx_XDECREF(__pyx_v_points);
  __Pyx_XDECREF(__pyx_v_p0);
  __Pyx_XDECREF(__pyx_v_mcmc_pool);
  __Pyx_XDECREF(__pyx_v_sampler);
  __Pyx_XDECREF(__pyx_v_nwalkers);
  __Pyx_XDECREF(__pyx_v_nprocesses);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":789
 *         return sampler
 * 
 *     def infer_mcmc_process_result(self, sampler, prior_dict, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                                   intervention_fun=None, flat=True, discard=0, thin=1, **catchall_kwargs):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_31infer_mcmc_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_30infer_mcmc_process_result[] = "\n        Take the sampler generated by `pyross.inference.infer_mcmc` and produce output dictionaries for further use in the\n        pyross framework. See `pyross.inference.infer_mcmc` for additional description of parameters.\n\n        Parameters\n        ----------\n        sampler: emcee.EnsembleSampler\n            Output of `pyross.inference.infer_mcmc`.\n        prior_dict: dict\n        contactMatrix: callable, optional\n        generator: pyross.contactMatrix, optional\n        intervention_fun: callable, optional\n        flat: bool, optional\n            This decides whether to return the samples as for each chain separately (False) or as as a combined\n            list (True). Default is True.\n        discard: int, optional\n            The number of initial samples to discard in each chain (to account for burn-in). Default is 0.\n        thin: int, optional\n            Thin out the chain by taking only the n-tn element in each chain. Default is 1 (no thinning).\n        **catchall_kwargs: dict\n            Catched further provided arguments and ignores them.\n\n        Returns\n        -------\n        output_samples: list of dict (if flat=True), or list of list of dict (if flat=False)\n            The processed posterior samples.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_31infer_mcmc_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_flat = 0;
  PyObject *__pyx_v_discard = 0;
  PyObject *__pyx_v_thin = 0;
  CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infer_mcmc_process_result (wrapper)", 0);
  __pyx_v_catchall_kwargs = PyDict_New(); if (unlikely(!__pyx_v_catchall_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_catchall_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_prior_dict,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_flat,&__pyx_n_s_discard,&__pyx_n_s_thin,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":790
 * 
 *     def infer_mcmc_process_result(self, sampler, prior_dict, contactMatrix=None, generator=None,
 *                                   intervention_fun=None, flat=True, discard=0, thin=1, **catchall_kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `pyross.inference.infer_mcmc` and produce output dictionaries for further use in the
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_True);
    values[6] = ((PyObject *)__pyx_int_0);
    values[7] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("infer_mcmc_process_result", 0, 2, 8, 1); __PYX_ERR(0, 789, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flat);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_discard);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thin);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_catchall_kwargs, values, pos_args, "infer_mcmc_process_result") < 0)) __PYX_ERR(0, 789, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sampler = values[0];
    __pyx_v_prior_dict = values[1];
    __pyx_v_contactMatrix = values[2];
    __pyx_v_generator = values[3];
    __pyx_v_intervention_fun = values[4];
    __pyx_v_flat = values[5];
    __pyx_v_discard = values[6];
    __pyx_v_thin = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infer_mcmc_process_result", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 789, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_catchall_kwargs); __pyx_v_catchall_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_mcmc_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_30infer_mcmc_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_prior_dict, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_flat, __pyx_v_discard, __pyx_v_thin, __pyx_v_catchall_kwargs);

  /* "pyross/inference.pyx":789
 *         return sampler
 * 
 *     def infer_mcmc_process_result(self, sampler, prior_dict, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                                   intervention_fun=None, flat=True, discard=0, thin=1, **catchall_kwargs):
 *         """
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_catchall_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_30infer_mcmc_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs) {
  PyObject *__pyx_v_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_flat_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_guesses = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_samples = NULL;
  PyObject *__pyx_v_log_posts = NULL;
  PyObject *__pyx_v_samples_per_chain = NULL;
  PyObject *__pyx_v_nr_chains = NULL;
  PyObject *__pyx_v_output_samples = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_v_weight = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_output_dict = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr1__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *(*__pyx_t_15)(PyObject *);
  Py_ssize_t __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  int __pyx_t_18;
  int __pyx_t_19;
  __Pyx_RefNannySetupContext("infer_mcmc_process_result", 0);

  /* "pyross/inference.pyx":818
 *             The processed posterior samples.
 *         """
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":820
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_check_length, __pyx_t_3) < 0) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 819, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 819, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
    __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 8) < 0) __PYX_ERR(0, 819, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 819, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "pyross/inference.pyx":819
 *         """
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)
 */
  __pyx_v_prior_names = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_keys = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_bounds = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_flat_guess_range = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_scaled_guesses = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":821
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_prior_names);
    __Pyx_GIVEREF(__pyx_v_prior_names);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_v_prior_names);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_prior = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":823
 *         prior = Prior(prior_names, bounds, guess, stds)
 * 
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)             # <<<<<<<<<<<<<<
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)
 *         samples_per_chain = samples.shape[0]
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_get_chain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_flat, __pyx_v_flat) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_thin, __pyx_v_thin) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_discard, __pyx_v_discard) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_samples = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":824
 * 
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)             # <<<<<<<<<<<<<<
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_get_log_prob); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_flat, __pyx_v_flat) < 0) __PYX_ERR(0, 824, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_thin, __pyx_v_thin) < 0) __PYX_ERR(0, 824, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_discard, __pyx_v_discard) < 0) __PYX_ERR(0, 824, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_log_posts = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":825
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)
 *         samples_per_chain = samples.shape[0]             # <<<<<<<<<<<<<<
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_samples, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_samples_per_chain = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":826
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]             # <<<<<<<<<<<<<<
 *         if flat:
 *             output_samples = []
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 826, __pyx_L1_error)
  if (__pyx_t_13) {
    __Pyx_INCREF(__pyx_int_1);
    __pyx_t_10 = __pyx_int_1;
  } else {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_samples, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  __pyx_v_nr_chains = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":827
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:             # <<<<<<<<<<<<<<
 *             output_samples = []
 *         else:
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 827, __pyx_L1_error)
  if (__pyx_t_13) {

    /* "pyross/inference.pyx":828
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:
 *             output_samples = []             # <<<<<<<<<<<<<<
 *         else:
 *             output_samples = [[] for _ in nr_chains]
 */
    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_v_output_samples = ((PyObject*)__pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":827
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:             # <<<<<<<<<<<<<<
 *             output_samples = []
 *         else:
 */
    goto __pyx_L5;
  }

  /* "pyross/inference.pyx":830
 *             output_samples = []
 *         else:
 *             output_samples = [[] for _ in nr_chains]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(samples_per_chain):
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 830, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (likely(PyList_CheckExact(__pyx_v_nr_chains)) || PyTuple_CheckExact(__pyx_v_nr_chains)) {
        __pyx_t_8 = __pyx_v_nr_chains; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
        __pyx_t_15 = NULL;
      } else {
        __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_nr_chains); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 830, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 830, __pyx_L8_error)
      }
      for (;;) {
        if (likely(!__pyx_t_15)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 830, __pyx_L8_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          } else {
            if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 830, __pyx_L8_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          }
        } else {
          __pyx_t_3 = __pyx_t_15(__pyx_t_8);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 830, __pyx_L8_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_3);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v__, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_10, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 830, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v__); __pyx_8genexpr1__pyx_v__ = 0;
      goto __pyx_L11_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v__); __pyx_8genexpr1__pyx_v__ = 0;
      goto __pyx_L1_error;
      __pyx_L11_exit_scope:;
    } /* exit inner scope */
    __pyx_v_output_samples = ((PyObject*)__pyx_t_10);
    __pyx_t_10 = 0;
  }
  __pyx_L5:;

  /* "pyross/inference.pyx":832
 *             output_samples = [[] for _ in nr_chains]
 * 
 *         for i in range(samples_per_chain):             # <<<<<<<<<<<<<<
 *             for j in range(nr_chains):
 *                 if flat:
 */
  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_samples_per_chain); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
    __pyx_t_8 = __pyx_t_10; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
    __pyx_t_15 = NULL;
  } else {
    __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 832, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (;;) {
    if (likely(!__pyx_t_15)) {
      if (likely(PyList_CheckExact(__pyx_t_8))) {
        if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_10); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 832, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 832, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      } else {
        if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_10); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 832, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 832, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      }
    } else {
      __pyx_t_10 = __pyx_t_15(__pyx_t_8);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 832, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_10);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":833
 * 
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):             # <<<<<<<<<<<<<<
 *                 if flat:
 *                     sample = samples[i,:]
 */
    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nr_chains); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
      __pyx_t_3 = __pyx_t_10; __Pyx_INCREF(__pyx_t_3); __pyx_t_16 = 0;
      __pyx_t_17 = NULL;
    } else {
      __pyx_t_16 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_17 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 833, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    for (;;) {
      if (likely(!__pyx_t_17)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_10); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 833, __pyx_L1_error)
          #else
          __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 833, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          #endif
        } else {
          if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_10); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 833, __pyx_L1_error)
          #else
          __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 833, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          #endif
        }
      } else {
        __pyx_t_10 = __pyx_t_17(__pyx_t_3);
        if (unlikely(!__pyx_t_10)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 833, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_10);
      }
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "pyross/inference.pyx":834
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     sample = samples[i,:]
 *                     l_post = log_posts[i]
 */
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 834, __pyx_L1_error)
      if (__pyx_t_13) {

        /* "pyross/inference.pyx":835
 *             for j in range(nr_chains):
 *                 if flat:
 *                     sample = samples[i,:]             # <<<<<<<<<<<<<<
 *                     l_post = log_posts[i]
 *                 else:
 */
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 835, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_slice_);
        __Pyx_GIVEREF(__pyx_slice_);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_slice_);
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_samples, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 835, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "pyross/inference.pyx":836
 *                 if flat:
 *                     sample = samples[i,:]
 *                     l_post = log_posts[i]             # <<<<<<<<<<<<<<
 *                 else:
 *                     sample = samples[i, j, :]
 */
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_log_posts, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 836, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "pyross/inference.pyx":834
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     sample = samples[i,:]
 *                     l_post = log_posts[i]
 */
        goto __pyx_L16;
      }

      /* "pyross/inference.pyx":838
 *                     l_post = log_posts[i]
 *                 else:
 *                     sample = samples[i, j, :]             # <<<<<<<<<<<<<<
 *                     l_post = log_posts[i, j]
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 */
      /*else*/ {
        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 838, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_j);
        __Pyx_INCREF(__pyx_slice_);
        __Pyx_GIVEREF(__pyx_slice_);
        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_slice_);
        __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_samples, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 838, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "pyross/inference.pyx":839
 *                 else:
 *                     sample = samples[i, j, :]
 *                     l_post = log_posts[i, j]             # <<<<<<<<<<<<<<
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 * 
 */
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 839, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_j);
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_log_posts, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 839, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_9);
        __pyx_t_9 = 0;
      }
      __pyx_L16:;

      /* "pyross/inference.pyx":840
 *                     sample = samples[i, j, :]
 *                     l_post = log_posts[i, j]
 *                 weight = 1.0 / (samples_per_chain * nr_chains)             # <<<<<<<<<<<<<<
 * 
 *                 orig_params = pyross.utils.unflatten_parameters(sample, flat_guess_range,
 */
      __pyx_t_9 = PyNumber_Multiply(__pyx_v_samples_per_chain, __pyx_v_nr_chains); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_0, __pyx_t_9, 1.0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_weight, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "pyross/inference.pyx":842
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 * 
 *                 orig_params = pyross.utils.unflatten_parameters(sample, flat_guess_range,             # <<<<<<<<<<<<<<
 *                                                                 is_scale_parameter, scaled_guesses)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyross); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 842, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 842, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 842, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyross/inference.pyx":843
 * 
 *                 orig_params = pyross.utils.unflatten_parameters(sample, flat_guess_range,
 *                                                                 is_scale_parameter, scaled_guesses)             # <<<<<<<<<<<<<<
 * 
 *                 map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 */
      __pyx_t_7 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_sample, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
        __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 842, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_10);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_sample, __pyx_v_flat_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_guesses};
        __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 842, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_10);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 842, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_sample);
        __Pyx_GIVEREF(__pyx_v_sample);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_sample);
        __Pyx_INCREF(__pyx_v_flat_guess_range);
        __Pyx_GIVEREF(__pyx_v_flat_guess_range);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_flat_guess_range);
        __Pyx_INCREF(__pyx_v_is_scale_parameter);
        __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
        PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
        __Pyx_INCREF(__pyx_v_scaled_guesses);
        __Pyx_GIVEREF(__pyx_v_scaled_guesses);
        PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_4, __pyx_v_scaled_guesses);
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 842, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_orig_params, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "pyross/inference.pyx":845
 *                                                                 is_scale_parameter, scaled_guesses)
 * 
 *                 map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *                 self.set_params(map_params_dict)
 * 
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_keys);
      __Pyx_GIVEREF(__pyx_v_keys);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_keys);
      __Pyx_INCREF(__pyx_v_orig_params);
      __Pyx_GIVEREF(__pyx_v_orig_params);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_orig_params);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 845, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 845, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 845, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 845, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_12(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_10), 2) < 0) __PYX_ERR(0, 845, __pyx_L1_error)
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L18_unpacking_done;
        __pyx_L17_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 845, __pyx_L1_error)
        __pyx_L18_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_map_params_dict, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_map_control_params_dict, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":846
 * 
 *                 map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 *                 self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *                 if generator is not None:
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_6, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_map_params_dict);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyross/inference.pyx":848
 *                 self.set_params(map_params_dict)
 * 
 *                 if generator is not None:             # <<<<<<<<<<<<<<
 *                     if intervention_fun is None:
 *                         self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
      __pyx_t_13 = (__pyx_v_generator != Py_None);
      __pyx_t_18 = (__pyx_t_13 != 0);
      if (__pyx_t_18) {

        /* "pyross/inference.pyx":849
 * 
 *                 if generator is not None:
 *                     if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                         self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *                     else:
 */
        __pyx_t_18 = (__pyx_v_intervention_fun == Py_None);
        __pyx_t_13 = (__pyx_t_18 != 0);
        if (__pyx_t_13) {

          /* "pyross/inference.pyx":850
 *                 if generator is not None:
 *                     if intervention_fun is None:
 *                         self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 850, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 850, __pyx_L1_error)
          }
          if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
            __pyx_t_9 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 850, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          } else {
            __pyx_t_9 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 850, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 850, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GIVEREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_v_self->contactMatrix);
          __Pyx_DECREF(__pyx_v_self->contactMatrix);
          __pyx_v_self->contactMatrix = __pyx_t_6;
          __pyx_t_6 = 0;

          /* "pyross/inference.pyx":849
 * 
 *                 if generator is not None:
 *                     if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                         self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *                     else:
 */
          goto __pyx_L20;
        }

        /* "pyross/inference.pyx":852
 *                         self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *                     else:
 *                         self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *                 l_prior = np.sum(prior.logpdf(sample))
 */
        /*else*/ {
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_v_intervention_fun);
          __Pyx_GIVEREF(__pyx_v_intervention_fun);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_intervention_fun);
          if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 852, __pyx_L1_error)
          }
          if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
            __pyx_t_7 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 852, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
          } else {
            __pyx_t_7 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 852, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GIVEREF(__pyx_t_10);
          __Pyx_GOTREF(__pyx_v_self->contactMatrix);
          __Pyx_DECREF(__pyx_v_self->contactMatrix);
          __pyx_v_self->contactMatrix = __pyx_t_10;
          __pyx_t_10 = 0;
        }
        __pyx_L20:;

        /* "pyross/inference.pyx":848
 *                 self.set_params(map_params_dict)
 * 
 *                 if generator is not None:             # <<<<<<<<<<<<<<
 *                     if intervention_fun is None:
 *                         self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
      }

      /* "pyross/inference.pyx":854
 *                         self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *                 l_prior = np.sum(prior.logpdf(sample))             # <<<<<<<<<<<<<<
 *                 l_like = l_post - l_prior
 *                 output_dict = {
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_v_sample) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sample);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_10 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_l_prior, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "pyross/inference.pyx":855
 * 
 *                 l_prior = np.sum(prior.logpdf(sample))
 *                 l_like = l_post - l_prior             # <<<<<<<<<<<<<<
 *                 output_dict = {
 *                     'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,
 */
      __pyx_t_10 = PyNumber_Subtract(__pyx_v_l_post, __pyx_v_l_prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 855, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_l_like, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "pyross/inference.pyx":857
 *                 l_like = l_post - l_prior
 *                 output_dict = {
 *                     'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,             # <<<<<<<<<<<<<<
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                     'weight':weight, 'is_scale_parameter':is_scale_parameter,
 */
      __pyx_t_10 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 857, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_params_dict, __pyx_v_map_params_dict) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_flat_params, __pyx_v_sample) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 857, __pyx_L1_error)

      /* "pyross/inference.pyx":858
 *                 output_dict = {
 *                     'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,             # <<<<<<<<<<<<<<
 *                     'weight':weight, 'is_scale_parameter':is_scale_parameter,
 *                     'param_guess_range':flat_guess_range,
 */
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0) __PYX_ERR(0, 857, __pyx_L1_error)

      /* "pyross/inference.pyx":859
 *                     'params_dict': map_params_dict, 'flat_params': sample, 'param_keys': keys,
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                     'weight':weight, 'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                     'param_guess_range':flat_guess_range,
 *                     'scaled_param_guesses':scaled_guesses,
 */
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_weight, __pyx_v_weight) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 857, __pyx_L1_error)

      /* "pyross/inference.pyx":860
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                     'weight':weight, 'is_scale_parameter':is_scale_parameter,
 *                     'param_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses':scaled_guesses,
 *                     'prior':prior
 */
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 857, __pyx_L1_error)

      /* "pyross/inference.pyx":861
 *                     'weight':weight, 'is_scale_parameter':is_scale_parameter,
 *                     'param_guess_range':flat_guess_range,
 *                     'scaled_param_guesses':scaled_guesses,             # <<<<<<<<<<<<<<
 *                     'prior':prior
 *                 }
 */
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 857, __pyx_L1_error)

      /* "pyross/inference.pyx":862
 *                     'param_guess_range':flat_guess_range,
 *                     'scaled_param_guesses':scaled_guesses,
 *                     'prior':prior             # <<<<<<<<<<<<<<
 *                 }
 *                 if map_control_params_dict != {}:
 */
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_output_dict, ((PyObject*)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "pyross/inference.pyx":864
 *                     'prior':prior
 *                 }
 *                 if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                     output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
      __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = PyObject_RichCompare(__pyx_v_map_control_params_dict, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_13) {

        /* "pyross/inference.pyx":865
 *                 }
 *                 if map_control_params_dict != {}:
 *                     output_dict['control_params_dict'] = map_control_params_dict             # <<<<<<<<<<<<<<
 * 
 *                 if flat:
 */
        if (unlikely(PyDict_SetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict, __pyx_v_map_control_params_dict) < 0)) __PYX_ERR(0, 865, __pyx_L1_error)

        /* "pyross/inference.pyx":864
 *                     'prior':prior
 *                 }
 *                 if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                     output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
      }

      /* "pyross/inference.pyx":867
 *                     output_dict['control_params_dict'] = map_control_params_dict
 * 
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     output_samples.append(output_dict)
 *                 else:
 */
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 867, __pyx_L1_error)
      if (__pyx_t_13) {

        /* "pyross/inference.pyx":868
 * 
 *                 if flat:
 *                     output_samples.append(output_dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     output_samples[j].append(output_dict)
 */
        __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_output_samples, __pyx_v_output_dict); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 868, __pyx_L1_error)

        /* "pyross/inference.pyx":867
 *                     output_dict['control_params_dict'] = map_control_params_dict
 * 
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     output_samples.append(output_dict)
 *                 else:
 */
        goto __pyx_L22;
      }

      /* "pyross/inference.pyx":870
 *                     output_samples.append(output_dict)
 *                 else:
 *                     output_samples[j].append(output_dict)             # <<<<<<<<<<<<<<
 * 
 *         return output_samples
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_output_samples, __pyx_v_j); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 870, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_19 = __Pyx_PyObject_Append(__pyx_t_9, __pyx_v_output_dict); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 870, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __pyx_L22:;

      /* "pyross/inference.pyx":833
 * 
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):             # <<<<<<<<<<<<<<
 *                 if flat:
 *                     sample = samples[i,:]
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":832
 *             output_samples = [[] for _ in nr_chains]
 * 
 *         for i in range(samples_per_chain):             # <<<<<<<<<<<<<<
 *             for j in range(nr_chains):
 *                 if flat:
 */
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pyross/inference.pyx":872
 *                     output_samples[j].append(output_dict)
 * 
 *         return output_samples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_samples);
  __pyx_r = __pyx_v_output_samples;
  goto __pyx_L0;

  /* "pyross/inference.pyx":789
 *         return sampler
 * 
 *     def infer_mcmc_process_result(self, sampler, prior_dict, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                                   intervention_fun=None, flat=True, discard=0, thin=1, **catchall_kwargs):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyross.inference.SIR_type.infer_mcmc_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_flat_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_guesses);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_samples);
  __Pyx_XDECREF(__pyx_v_log_posts);
  __Pyx_XDECREF(__pyx_v_samples_per_chain);
  __Pyx_XDECREF(__pyx_v_nr_chains);
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_weight);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v__);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":875
 * 
 * 
 *     def _mean(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_33_mean(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_32_mean[] = "Objective function for differentiation call in FIM and FIM_det.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_33_mean(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_param_keys = 0;
  PyObject *__pyx_v_param_guess_range = 0;
  PyObject *__pyx_v_is_scale_parameter = 0;
  PyObject *__pyx_v_scaled_param_guesses = 0;
  PyObject *__pyx_v_x0 = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_mean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_param_keys,&__pyx_n_s_param_guess_range,&__pyx_n_s_is_scale_parameter,&__pyx_n_s_scaled_param_guesses,&__pyx_n_s_x0,&__pyx_n_s_Tf,&__pyx_n_s_inter_steps,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":876
 * 
 *     def _mean(self, params, contactMatrix=None,
 *                       generator=None, intervention_fun=None,             # <<<<<<<<<<<<<<
 *               param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":877
 *     def _mean(self, params, contactMatrix=None,
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,             # <<<<<<<<<<<<<<
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None,
 */
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":878
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,             # <<<<<<<<<<<<<<
 *                             scaled_param_guesses=None,
 *                             x0=None, Tf=None, inter_steps=None):
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":879
 *               param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None,             # <<<<<<<<<<<<<<
 *                             x0=None, Tf=None, inter_steps=None):
 *         """Objective function for differentiation call in FIM and FIM_det."""
 */
    values[7] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":880
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None,
 *                             x0=None, Tf=None, inter_steps=None):             # <<<<<<<<<<<<<<
 *         """Objective function for differentiation call in FIM and FIM_det."""
 *         param_estimates = np.copy(params)
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_keys);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_guess_range);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_scale_parameter);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaled_param_guesses);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mean") < 0)) __PYX_ERR(0, 875, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_contactMatrix = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_intervention_fun = values[3];
    __pyx_v_param_keys = values[4];
    __pyx_v_param_guess_range = values[5];
    __pyx_v_is_scale_parameter = values[6];
    __pyx_v_scaled_param_guesses = values[7];
    __pyx_v_x0 = values[8];
    __pyx_v_Tf = values[9];
    __pyx_v_inter_steps = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_mean", 0, 1, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 875, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_32_mean(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_param_keys, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses, __pyx_v_x0, __pyx_v_Tf, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":875
 * 
 * 
 *     def _mean(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_32_mean(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_x0, PyObject *__pyx_v_Tf, PyObject *__pyx_v_inter_steps) {
  PyObject *__pyx_v_param_estimates = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_Nf = NULL;
  PyObject *__pyx_v_xm = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_mean", 0);
  __Pyx_INCREF(__pyx_v_x0);

  /* "pyross/inference.pyx":882
 *                             x0=None, Tf=None, inter_steps=None):
 *         """Objective function for differentiation call in FIM and FIM_det."""
 *         param_estimates = np.copy(params)             # <<<<<<<<<<<<<<
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_params) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_params);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_param_estimates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":884
 *         param_estimates = np.copy(params)
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,             # <<<<<<<<<<<<<<
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":887
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 *                                                       scaled_param_guesses)             # <<<<<<<<<<<<<<
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 */
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_param_estimates);
    __Pyx_GIVEREF(__pyx_v_param_estimates);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_param_estimates);
    __Pyx_INCREF(__pyx_v_param_guess_range);
    __Pyx_GIVEREF(__pyx_v_param_guess_range);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_param_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_param_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_scaled_param_guesses);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_orig_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":889
 *                                                       scaled_param_guesses)
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *         self.set_params(map_params_dict)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_param_keys);
  __Pyx_GIVEREF(__pyx_v_param_keys);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_param_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_orig_params);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 889, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 889, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(0, 889, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 889, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_map_params_dict = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_map_control_params_dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":890
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 *         self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":892
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  __pyx_t_7 = (__pyx_v_generator != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":893
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
    __pyx_t_8 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "pyross/inference.pyx":894
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 894, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_3 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pyross/inference.pyx":893
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
      goto __pyx_L6;
    }

    /* "pyross/inference.pyx":896
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         Nf = Tf+1
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 896, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "pyross/inference.pyx":892
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  }

  /* "pyross/inference.pyx":898
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *         Nf = Tf+1             # <<<<<<<<<<<<<<
 * 
 *         if inter_steps:
 */
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_Tf, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Nf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":900
 *         Nf = Tf+1
 * 
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_inter_steps); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 900, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":901
 * 
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)             # <<<<<<<<<<<<<<
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 *             xm = xm[::inter_steps]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_multiply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x0, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x0, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 901, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x0);
      __Pyx_GIVEREF(__pyx_v_x0);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_v_x0);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":902
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)             # <<<<<<<<<<<<<<
 *             xm = xm[::inter_steps]
 *             xm = np.divide(xm, self.Omega)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_forward_euler_integration); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rhs0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[7] = {__pyx_t_2, __pyx_t_9, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf, __pyx_v_inter_steps};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 6+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[7] = {__pyx_t_2, __pyx_t_9, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf, __pyx_v_inter_steps};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 6+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(6+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 902, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_t_9);
      __Pyx_INCREF(__pyx_v_x0);
      __Pyx_GIVEREF(__pyx_v_x0);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_x0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_int_0);
      __Pyx_INCREF(__pyx_v_Tf);
      __Pyx_GIVEREF(__pyx_v_Tf);
      PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_Tf);
      __Pyx_INCREF(__pyx_v_Nf);
      __Pyx_GIVEREF(__pyx_v_Nf);
      PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_Nf);
      __Pyx_INCREF(__pyx_v_inter_steps);
      __Pyx_GIVEREF(__pyx_v_inter_steps);
      PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_inter_steps);
      __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_xm = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":903
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 *             xm = xm[::inter_steps]             # <<<<<<<<<<<<<<
 *             xm = np.divide(xm, self.Omega)
 *         else:
 */
    __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_v_inter_steps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_xm, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_xm, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":904
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 *             xm = xm[::inter_steps]
 *             xm = np.divide(xm, self.Omega)             # <<<<<<<<<<<<<<
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_divide); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_xm, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_xm, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_xm);
      __Pyx_GIVEREF(__pyx_v_xm);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_xm);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_xm, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":900
 *         Nf = Tf+1
 * 
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 */
    goto __pyx_L7;
  }

  /* "pyross/inference.pyx":906
 *             xm = np.divide(xm, self.Omega)
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)             # <<<<<<<<<<<<<<
 *         return np.ravel(xm[1:])
 * 
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_integrate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x0);
      __Pyx_GIVEREF(__pyx_v_x0);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_v_x0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_0);
      __Pyx_INCREF(__pyx_v_Tf);
      __Pyx_GIVEREF(__pyx_v_Tf);
      PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_4, __pyx_v_Tf);
      __Pyx_INCREF(__pyx_v_Nf);
      __Pyx_GIVEREF(__pyx_v_Nf);
      PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_4, __pyx_v_Nf);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_xm = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L7:;

  /* "pyross/inference.pyx":907
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)
 *         return np.ravel(xm[1:])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ravel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_xm, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":875
 * 
 * 
 *     def _mean(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SIR_type._mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_estimates);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_Nf);
  __Pyx_XDECREF(__pyx_v_xm);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":910
 * 
 * 
 *     def _cov(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_35_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_34_cov[] = "Objective function for differentiation call in FIM.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_35_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_param_keys = 0;
  PyObject *__pyx_v_param_guess_range = 0;
  PyObject *__pyx_v_is_scale_parameter = 0;
  PyObject *__pyx_v_scaled_param_guesses = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_x0 = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cov (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_param_keys,&__pyx_n_s_param_guess_range,&__pyx_n_s_is_scale_parameter,&__pyx_n_s_scaled_param_guesses,&__pyx_n_s_Tf,&__pyx_n_s_x0,&__pyx_n_s_inter_steps,&__pyx_n_s_tangent,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":911
 * 
 *     def _cov(self, params, contactMatrix=None,
 *              generator=None, intervention_fun=None,             # <<<<<<<<<<<<<<
 *              param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":912
 *     def _cov(self, params, contactMatrix=None,
 *              generator=None, intervention_fun=None,
 *              param_keys=None,             # <<<<<<<<<<<<<<
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None,
 */
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":913
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,             # <<<<<<<<<<<<<<
 *                             scaled_param_guesses=None,
 *                             Tf=None, x0=None,
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":914
 *              param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None,             # <<<<<<<<<<<<<<
 *                             Tf=None, x0=None,
 *                             inter_steps=None, tangent=False):
 */
    values[7] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":915
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None,
 *                             Tf=None, x0=None,             # <<<<<<<<<<<<<<
 *                             inter_steps=None, tangent=False):
 *         """Objective function for differentiation call in FIM."""
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":916
 *                             scaled_param_guesses=None,
 *                             Tf=None, x0=None,
 *                             inter_steps=None, tangent=False):             # <<<<<<<<<<<<<<
 *         """Objective function for differentiation call in FIM."""
 *         param_estimates = np.copy(params)
 */
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_keys);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_guess_range);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_scale_parameter);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaled_param_guesses);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[11] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cov") < 0)) __PYX_ERR(0, 910, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_contactMatrix = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_intervention_fun = values[3];
    __pyx_v_param_keys = values[4];
    __pyx_v_param_guess_range = values[5];
    __pyx_v_is_scale_parameter = values[6];
    __pyx_v_scaled_param_guesses = values[7];
    __pyx_v_Tf = values[8];
    __pyx_v_x0 = values[9];
    __pyx_v_inter_steps = values[10];
    __pyx_v_tangent = values[11];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_cov", 0, 1, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 910, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_34_cov(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_param_keys, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses, __pyx_v_Tf, __pyx_v_x0, __pyx_v_inter_steps, __pyx_v_tangent);

  /* "pyross/inference.pyx":910
 * 
 * 
 *     def _cov(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_34_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_Tf, PyObject *__pyx_v_x0, PyObject *__pyx_v_inter_steps, PyObject *__pyx_v_tangent) {
  PyObject *__pyx_v_param_estimates = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_Nf = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_xm = NULL;
  PyObject *__pyx_v_full_cov = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space __pyx_t_13;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov __pyx_t_14;
  __Pyx_RefNannySetupContext("_cov", 0);

  /* "pyross/inference.pyx":918
 *                             inter_steps=None, tangent=False):
 *         """Objective function for differentiation call in FIM."""
 *         param_estimates = np.copy(params)             # <<<<<<<<<<<<<<
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_params) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_params);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_param_estimates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":920
 *         param_estimates = np.copy(params)
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,             # <<<<<<<<<<<<<<
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":923
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 *                                                       scaled_param_guesses)             # <<<<<<<<<<<<<<
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 */
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_param_estimates);
    __Pyx_GIVEREF(__pyx_v_param_estimates);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_param_estimates);
    __Pyx_INCREF(__pyx_v_param_guess_range);
    __Pyx_GIVEREF(__pyx_v_param_guess_range);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_param_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_param_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_scaled_param_guesses);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_orig_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":925
 *                                                       scaled_param_guesses)
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *         self.set_params(map_params_dict)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_param_keys);
  __Pyx_GIVEREF(__pyx_v_param_keys);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_param_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_orig_params);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 925, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 925, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(0, 925, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 925, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_map_params_dict = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_map_control_params_dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":926
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 *         self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":928
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  __pyx_t_7 = (__pyx_v_generator != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":929
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
    __pyx_t_8 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "pyross/inference.pyx":930
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 930, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_3 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 930, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 930, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pyross/inference.pyx":929
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
      goto __pyx_L6;
    }

    /* "pyross/inference.pyx":932
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         Nf = Tf+1
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 932, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 932, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 932, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "pyross/inference.pyx":928
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  }

  /* "pyross/inference.pyx":934
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *         Nf = Tf+1             # <<<<<<<<<<<<<<
 * 
 *         if tangent:
 */
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_Tf, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Nf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":936
 *         Nf = Tf+1
 * 
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,
 *                                                                   inter_steps)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 936, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":937
 * 
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,             # <<<<<<<<<<<<<<
 *                                                                   inter_steps)
 *         else:
 */
    __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_x0, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 937, __pyx_L1_error)
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_Nf); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L1_error)

    /* "pyross/inference.pyx":938
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,
 *                                                                   inter_steps)             # <<<<<<<<<<<<<<
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps)
 */
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_inter_steps); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error)

    /* "pyross/inference.pyx":937
 * 
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,             # <<<<<<<<<<<<<<
 *                                                                   inter_steps)
 *         else:
 */
    __pyx_t_13.__pyx_n = 1;
    __pyx_t_13.inter_steps = __pyx_t_12;
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov_tangent_space(__pyx_v_self, __pyx_t_9, __pyx_t_10, __pyx_t_11, 0, &__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 937, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 937, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 937, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 937, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_full_cov = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":936
 *         Nf = Tf+1
 * 
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,
 *                                                                   inter_steps)
 */
    goto __pyx_L7;
  }

  /* "pyross/inference.pyx":940
 *                                                                   inter_steps)
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps)             # <<<<<<<<<<<<<<
 * 
 *         return full_cov
 */
  /*else*/ {
    __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_x0, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 940, __pyx_L1_error)
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_Nf); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_inter_steps); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error)
    __pyx_t_14.__pyx_n = 1;
    __pyx_t_14.inter_steps = __pyx_t_11;
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov(__pyx_v_self, __pyx_t_9, __pyx_t_10, __pyx_t_12, 0, &__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 940, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 940, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 940, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_full_cov = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L7:;

  /* "pyross/inference.pyx":942
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps)
 * 
 *         return full_cov             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_full_cov);
  __pyx_r = __pyx_v_full_cov;
  goto __pyx_L0;

  /* "pyross/inference.pyx":910
 * 
 * 
 *     def _cov(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_estimates);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_Nf);
  __Pyx_XDECREF(__pyx_v_xm);
  __Pyx_XDECREF(__pyx_v_full_cov);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":945
 * 
 * 
 *     def FIM(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *             intervention_fun=None, tangent=False, eps=None, inter_steps=100):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_37FIM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_36FIM[] = "\n        Computes the Fisher Information Matrix (FIM) for the MAP estimates of a stochastic SIR type model.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        eps: float or numpy.array, optional\n            Step size for numerical differentiation of the process mean and its full covariance matrix with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result['flat_params'])`. If not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_likelihood']),infer_result['log_likelihood'])**(0.25)` is used. It is"" recommended to use a step-size greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        inter_steps: int, optional\n            Intermediate steps for interpolation between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 100.\n        Returns\n        -------\n        FIM: 2d numpy.array\n            The Fisher Information Matrix\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_37FIM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("FIM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_eps,&__pyx_n_s_inter_steps,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":946
 * 
 *     def FIM(self, x, Tf, infer_result, contactMatrix=None, generator=None,
 *             intervention_fun=None, tangent=False, eps=None, inter_steps=100):             # <<<<<<<<<<<<<<
 *         '''
 *         Computes the Fisher Information Matrix (FIM) for the MAP estimates of a stochastic SIR type model.
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_False);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("FIM", 0, 3, 9, 1); __PYX_ERR(0, 945, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("FIM", 0, 3, 9, 2); __PYX_ERR(0, 945, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "FIM") < 0)) __PYX_ERR(0, 945, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_infer_result = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_eps = values[7];
    __pyx_v_inter_steps = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("FIM", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 945, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_36FIM(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":945
 * 
 * 
 *     def FIM(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *             intervention_fun=None, tangent=False, eps=None, inter_steps=100):
 *         '''
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":999
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3FIM_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_3FIM_1mean = {"mean", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_3FIM_1mean, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3FIM_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mean (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3FIM_mean(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3FIM_mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mean", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":1000
 * 
 *         def mean(y):
 *             return self._mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1000, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_contactMatrix)) { __Pyx_RaiseClosureNameError("contactMatrix"); __PYX_ERR(0, 1000, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_cur_scope->__pyx_v_contactMatrix) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)

  /* "pyross/inference.pyx":1001
 *         def mean(y):
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,             # <<<<<<<<<<<<<<
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, inter_steps=inter_steps,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_generator)) { __Pyx_RaiseClosureNameError("generator"); __PYX_ERR(0, 1001, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_cur_scope->__pyx_v_generator) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)

  /* "pyross/inference.pyx":1002
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,             # <<<<<<<<<<<<<<
 *                               Tf=Tf, inter_steps=inter_steps,
 *                               **kwargs)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_intervention_fun)) { __Pyx_RaiseClosureNameError("intervention_fun"); __PYX_ERR(0, 1002, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, __pyx_cur_scope->__pyx_v_intervention_fun) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_x0)) { __Pyx_RaiseClosureNameError("x0"); __PYX_ERR(0, 1002, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x0, __pyx_cur_scope->__pyx_v_x0) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)

  /* "pyross/inference.pyx":1003
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, inter_steps=inter_steps,             # <<<<<<<<<<<<<<
 *                               **kwargs)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 1003, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_inter_steps)) { __Pyx_RaiseClosureNameError("inter_steps"); __PYX_ERR(0, 1003, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inter_steps, __pyx_cur_scope->__pyx_v_inter_steps) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1004
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, inter_steps=inter_steps,
 *                               **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         def covariance(y):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 1004, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 1004, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 1004, __pyx_L1_error)

  /* "pyross/inference.pyx":1000
 * 
 *         def mean(y):
 *             return self._mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":999
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1006
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3FIM_3covariance(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_3FIM_3covariance = {"covariance", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_3FIM_3covariance, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3FIM_3covariance(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("covariance (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3FIM_2covariance(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3FIM_2covariance(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("covariance", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":1007
 * 
 *         def covariance(y):
 *             return self._cov(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1007, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_cov); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_contactMatrix)) { __Pyx_RaiseClosureNameError("contactMatrix"); __PYX_ERR(0, 1007, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_cur_scope->__pyx_v_contactMatrix) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)

  /* "pyross/inference.pyx":1008
 *         def covariance(y):
 *             return self._cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,             # <<<<<<<<<<<<<<
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, tangent=tangent, inter_steps=inter_steps,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_generator)) { __Pyx_RaiseClosureNameError("generator"); __PYX_ERR(0, 1008, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_cur_scope->__pyx_v_generator) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)

  /* "pyross/inference.pyx":1009
 *             return self._cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,             # <<<<<<<<<<<<<<
 *                               Tf=Tf, tangent=tangent, inter_steps=inter_steps,
 *                               **kwargs)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_intervention_fun)) { __Pyx_RaiseClosureNameError("intervention_fun"); __PYX_ERR(0, 1009, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, __pyx_cur_scope->__pyx_v_intervention_fun) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_x0)) { __Pyx_RaiseClosureNameError("x0"); __PYX_ERR(0, 1009, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x0, __pyx_cur_scope->__pyx_v_x0) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)

  /* "pyross/inference.pyx":1010
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, tangent=tangent, inter_steps=inter_steps,             # <<<<<<<<<<<<<<
 *                               **kwargs)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 1010, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_tangent)) { __Pyx_RaiseClosureNameError("tangent"); __PYX_ERR(0, 1010, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tangent, __pyx_cur_scope->__pyx_v_tangent) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_inter_steps)) { __Pyx_RaiseClosureNameError("inter_steps"); __PYX_ERR(0, 1010, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inter_steps, __pyx_cur_scope->__pyx_v_inter_steps) < 0) __PYX_ERR(0, 1007, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1011
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, tangent=tangent, inter_steps=inter_steps,
 *                               **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if np.all(eps == None):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 1011, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 1011, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 1011, __pyx_L1_error)

  /* "pyross/inference.pyx":1007
 * 
 *         def covariance(y):
 *             return self._cov(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1006
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM.covariance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":945
 * 
 * 
 *     def FIM(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *             intervention_fun=None, tangent=False, eps=None, inter_steps=100):
 *         '''
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_36FIM(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_inter_steps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *__pyx_cur_scope;
  PyObject *__pyx_v_infer_result_loc = NULL;
  PyObject *__pyx_v_flat_params = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_mean = 0;
  PyObject *__pyx_v_covariance = 0;
  PyObject *__pyx_v_xx = NULL;
  PyObject *__pyx_v_fx = NULL;
  PyObject *__pyx_v_cov = NULL;
  PyObject *__pyx_v_invcov = NULL;
  Py_ssize_t __pyx_v_dim;
  PyObject *__pyx_v_FIM = NULL;
  PyObject *__pyx_v_dmu = NULL;
  PyObject *__pyx_v_dcov = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_t1 = NULL;
  PyObject *__pyx_v_t2 = NULL;
  PyObject *__pyx_v_rows = NULL;
  PyObject *__pyx_v_cols = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_i_lower = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  __Pyx_RefNannySetupContext("FIM", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct__FIM(__pyx_ptype_6pyross_9inference___pyx_scope_struct__FIM, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 945, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_Tf = __pyx_v_Tf;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Tf);
  __pyx_cur_scope->__pyx_v_contactMatrix = __pyx_v_contactMatrix;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __pyx_cur_scope->__pyx_v_generator = __pyx_v_generator;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
  __pyx_cur_scope->__pyx_v_intervention_fun = __pyx_v_intervention_fun;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __pyx_cur_scope->__pyx_v_tangent = __pyx_v_tangent;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tangent);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tangent);
  __pyx_cur_scope->__pyx_v_inter_steps = __pyx_v_inter_steps;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_INCREF(__pyx_v_eps);

  /* "pyross/inference.pyx":984
 *         '''
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_generator);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_cur_scope->__pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":985
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         infer_result_loc = infer_result.copy()             # <<<<<<<<<<<<<<
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_infer_result_loc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":987
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_flat_map, __pyx_v_infer_result_loc, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 987, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":988
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')             # <<<<<<<<<<<<<<
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result_loc, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_u_flat_map) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_flat_map);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params, __pyx_t_1) < 0)) __PYX_ERR(0, 988, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":987
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  }

  /* "pyross/inference.pyx":990
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])             # <<<<<<<<<<<<<<
 * 
 *         kwargs = {}
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_flat_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":992
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 * 
 *         kwargs = {}             # <<<<<<<<<<<<<<
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses']:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":993
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]
 */
  __pyx_t_1 = __pyx_tuple__9; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= 4) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 993, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":995
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]             # <<<<<<<<<<<<<<
 * 
 *         x0 = x[0]
 */
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_v_key, __pyx_t_5) < 0)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":993
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":997
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         x0 = x[0]             # <<<<<<<<<<<<<<
 * 
 *         def mean(y):
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_x0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":999
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_3FIM_1mean, 0, __pyx_n_s_FIM_locals_mean, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mean = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1006
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_3FIM_3covariance, 0, __pyx_n_s_FIM_locals_covariance, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_covariance = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1013
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_eps, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":1014
 * 
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']             # <<<<<<<<<<<<<<
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_xx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1015
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])             # <<<<<<<<<<<<<<
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_log_likelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1016
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)             # <<<<<<<<<<<<<<
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 */
    __pyx_t_2 = PyNumber_Multiply(__pyx_int_100, __pyx_v_xx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_divide); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_spacing); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_fx) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_fx);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_5, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_5, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1016, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_fx);
      __Pyx_GIVEREF(__pyx_v_fx);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_v_fx);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_float_0_25, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1013
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
    goto __pyx_L6;
  }

  /* "pyross/inference.pyx":1018
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isscalar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_eps) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_eps);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":1019
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))             # <<<<<<<<<<<<<<
 *         print('eps-vector used for differentiation: ', eps)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_repeat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_eps);
    __Pyx_GIVEREF(__pyx_v_eps);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_eps);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1019, __pyx_L1_error)
    __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_repeats, __pyx_t_9) < 0) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":1018
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  }
  __pyx_L6:;

  /* "pyross/inference.pyx":1020
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)             # <<<<<<<<<<<<<<
 * 
 *         cov = covariance(flat_params)
 */
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_GIVEREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_eps);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1022
 *         print('eps-vector used for differentiation: ', eps)
 * 
 *         cov = covariance(flat_params)             # <<<<<<<<<<<<<<
 *         invcov = np.linalg.inv(cov)
 * 
 */
  __pyx_t_3 = __pyx_pf_6pyross_9inference_8SIR_type_3FIM_2covariance(__pyx_v_covariance, __pyx_v_flat_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_cov = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1023
 * 
 *         cov = covariance(flat_params)
 *         invcov = np.linalg.inv(cov)             # <<<<<<<<<<<<<<
 * 
 *         dim = len(flat_params)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_linalg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inv); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_1, __pyx_v_cov) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_cov);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_invcov = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1025
 *         invcov = np.linalg.inv(cov)
 * 
 *         dim = len(flat_params)             # <<<<<<<<<<<<<<
 *         FIM = np.empty((dim,dim))
 *         dmu = []
 */
  __pyx_t_8 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1025, __pyx_L1_error)
  __pyx_v_dim = __pyx_t_8;

  /* "pyross/inference.pyx":1026
 * 
 *         dim = len(flat_params)
 *         FIM = np.empty((dim,dim))             # <<<<<<<<<<<<<<
 *         dmu = []
 *         dcov = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_9 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_FIM = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1027
 *         dim = len(flat_params)
 *         FIM = np.empty((dim,dim))
 *         dmu = []             # <<<<<<<<<<<<<<
 *         dcov = []
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_dmu = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1028
 *         FIM = np.empty((dim,dim))
 *         dmu = []
 *         dcov = []             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_dcov = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1030
 *         dcov = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 */
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1030, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1030, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1030, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_11(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1030, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1031
 * 
 *         for i in range(dim):
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))             # <<<<<<<<<<<<<<
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_partial_derivative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_mean);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_var, __pyx_v_i) < 0) __PYX_ERR(0, 1031, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_point, __pyx_v_flat_params) < 0) __PYX_ERR(0, 1031, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_eps, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dx, __pyx_t_9) < 0) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_dmu, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyross/inference.pyx":1032
 *         for i in range(dim):
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyross); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_partial_derivative); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_covariance);
    __Pyx_GIVEREF(__pyx_v_covariance);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_covariance);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_var, __pyx_v_i) < 0) __PYX_ERR(0, 1032, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_point, __pyx_v_flat_params) < 0) __PYX_ERR(0, 1032, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_eps, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dx, __pyx_t_1) < 0) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_dcov, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1030
 *         dcov = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1034
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 */
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1034, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1034, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1034, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_11(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1034, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1035
 * 
 *         for i in range(dim):
 *             t1 = dmu[i]@invcov@dmu[i]             # <<<<<<<<<<<<<<
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 *             FIM[i,i] = t1 + t2
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_v_invcov); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1036
 *         for i in range(dim):
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))             # <<<<<<<<<<<<<<
 *             FIM[i,i] = t1 + t2
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiply); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_trace); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_invcov, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_13, __pyx_v_invcov); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_1 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_13, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_14);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(__pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_float_0_5);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_4, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1037
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 *             FIM[i,i] = t1 + t2             # <<<<<<<<<<<<<<
 * 
 *         rows,cols = np.triu_indices(dim,1)
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_t1, __pyx_v_t2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_i);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM, __pyx_t_5, __pyx_t_2) < 0)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1034
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1039
 *             FIM[i,i] = t1 + t2
 * 
 *         rows,cols = np.triu_indices(dim,1)             # <<<<<<<<<<<<<<
 * 
 *         for i,j in zip(rows,cols):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_triu_indices); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_2, __pyx_int_1};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_2, __pyx_int_1};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_14); __pyx_t_14 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1039, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_15(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_1 = __pyx_t_15(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_2), 2) < 0) __PYX_ERR(0, 1039, __pyx_L1_error)
    __pyx_t_15 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_15 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1039, __pyx_L1_error)
    __pyx_L12_unpacking_done:;
  }
  __pyx_v_rows = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_cols = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1041
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_rows);
  __Pyx_GIVEREF(__pyx_v_rows);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rows);
  __Pyx_INCREF(__pyx_v_cols);
  __Pyx_GIVEREF(__pyx_v_cols);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cols);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1041, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_11(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1041, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1041, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_14 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_5)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_2 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_2)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1041, __pyx_L1_error)
      __pyx_t_15 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_15 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1041, __pyx_L1_error)
      __pyx_L16_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1042
 * 
 *         for i,j in zip(rows,cols):
 *             t1 = dmu[i]@invcov@dmu[j]             # <<<<<<<<<<<<<<
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 *             FIM[i,j] = t1 + t2
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_v_invcov); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1043
 *         for i,j in zip(rows,cols):
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))             # <<<<<<<<<<<<<<
 *             FIM[i,j] = t1 + t2
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiply); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_trace); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_i); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_13 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_invcov, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_13, __pyx_v_invcov); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_9 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_1 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_13, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1043, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1043, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1043, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(__pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_float_0_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1043, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1044
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 *             FIM[i,j] = t1 + t2             # <<<<<<<<<<<<<<
 * 
 *         i_lower = np.tril_indices(dim,-1)
 */
    __pyx_t_5 = PyNumber_Add(__pyx_v_t1, __pyx_v_t2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_j);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM, __pyx_t_2, __pyx_t_5) < 0)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1041
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1046
 *             FIM[i,j] = t1 + t2
 * 
 *         i_lower = np.tril_indices(dim,-1)             # <<<<<<<<<<<<<<
 *         FIM[i_lower] = FIM.T[i_lower]
 *         return FIM
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tril_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_5, __pyx_int_neg_1};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_5, __pyx_int_neg_1};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_t_5);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_neg_1);
    __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_i_lower = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1047
 * 
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM[i_lower] = FIM.T[i_lower]             # <<<<<<<<<<<<<<
 *         return FIM
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_FIM, __pyx_n_s_T); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_i_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_FIM, __pyx_v_i_lower, __pyx_t_2) < 0)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":1048
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM[i_lower] = FIM.T[i_lower]
 *         return FIM             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_FIM);
  __pyx_r = __pyx_v_FIM;
  goto __pyx_L0;

  /* "pyross/inference.pyx":945
 * 
 * 
 *     def FIM(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *             intervention_fun=None, tangent=False, eps=None, inter_steps=100):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_infer_result_loc);
  __Pyx_XDECREF(__pyx_v_flat_params);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_covariance);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_fx);
  __Pyx_XDECREF(__pyx_v_cov);
  __Pyx_XDECREF(__pyx_v_invcov);
  __Pyx_XDECREF(__pyx_v_FIM);
  __Pyx_XDECREF(__pyx_v_dmu);
  __Pyx_XDECREF(__pyx_v_dcov);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_t1);
  __Pyx_XDECREF(__pyx_v_t2);
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_i_lower);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1051
 * 
 * 
 *     def FIM_det(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, eps=None, measurement_error=1e-2,
 *                 inter_steps=100):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_39FIM_det(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_38FIM_det[] = "\n        Computes the Fisher Information Matrix (FIM) for the MAP estimates of a deterministic (ODE based, including a constant measurement error) SIR type model.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        eps: float or numpy.array, optional\n            Step size for numerical differentiation of the process mean and its full covariance matrix with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result['flat_params'])`. If not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_likelihood']),infer_result['log_likelihood'])**(0.25)` is used. It is recommended to use a step-size greater or equal to `""eps_min`. Decreasing the step size too small can result in round-off error.\n        measurement_error: float, optional\n            Standard deviation of measurements (uniform and independent Gaussian measurement error assumed). Default is 1e-2.\n        inter_steps: int, optional\n            Intermediate steps for interpolation between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 100.\n        Returns\n        -------\n        FIM: 2d numpy.array\n            The Fisher Information Matrix\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_39FIM_det(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_measurement_error = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("FIM_det (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_eps,&__pyx_n_s_measurement_error,&__pyx_n_s_inter_steps,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1052
 * 
 *     def FIM_det(self, x, Tf, infer_result, contactMatrix=None, generator=None,
 *                 intervention_fun=None, eps=None, measurement_error=1e-2,             # <<<<<<<<<<<<<<
 *                 inter_steps=100):
 *         '''
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)__pyx_float_1eneg_2);
    values[8] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("FIM_det", 0, 3, 9, 1); __PYX_ERR(0, 1051, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("FIM_det", 0, 3, 9, 2); __PYX_ERR(0, 1051, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_measurement_error);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "FIM_det") < 0)) __PYX_ERR(0, 1051, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_infer_result = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_eps = values[6];
    __pyx_v_measurement_error = values[7];
    __pyx_v_inter_steps = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("FIM_det", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1051, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM_det", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_38FIM_det(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_eps, __pyx_v_measurement_error, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":1051
 * 
 * 
 *     def FIM_det(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, eps=None, measurement_error=1e-2,
 *                 inter_steps=100):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1106
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7FIM_det_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_7FIM_det_1mean = {"mean", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_7FIM_det_1mean, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7FIM_det_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mean (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_7FIM_det_mean(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_7FIM_det_mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mean", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":1107
 * 
 *         def mean(y):
 *             return self._mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1107, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_contactMatrix)) { __Pyx_RaiseClosureNameError("contactMatrix"); __PYX_ERR(0, 1107, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_cur_scope->__pyx_v_contactMatrix) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)

  /* "pyross/inference.pyx":1108
 *         def mean(y):
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,             # <<<<<<<<<<<<<<
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, inter_steps=inter_steps,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_generator)) { __Pyx_RaiseClosureNameError("generator"); __PYX_ERR(0, 1108, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_cur_scope->__pyx_v_generator) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)

  /* "pyross/inference.pyx":1109
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,             # <<<<<<<<<<<<<<
 *                               Tf=Tf, inter_steps=inter_steps,
 *                               **kwargs)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_intervention_fun)) { __Pyx_RaiseClosureNameError("intervention_fun"); __PYX_ERR(0, 1109, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, __pyx_cur_scope->__pyx_v_intervention_fun) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_x0)) { __Pyx_RaiseClosureNameError("x0"); __PYX_ERR(0, 1109, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x0, __pyx_cur_scope->__pyx_v_x0) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)

  /* "pyross/inference.pyx":1110
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, inter_steps=inter_steps,             # <<<<<<<<<<<<<<
 *                               **kwargs)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 1110, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_inter_steps)) { __Pyx_RaiseClosureNameError("inter_steps"); __PYX_ERR(0, 1110, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inter_steps, __pyx_cur_scope->__pyx_v_inter_steps) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1111
 *                               intervention_fun=intervention_fun, x0=x0,
 *                               Tf=Tf, inter_steps=inter_steps,
 *                               **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if np.all(eps == None):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 1111, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 1111, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 1111, __pyx_L1_error)

  /* "pyross/inference.pyx":1107
 * 
 *         def mean(y):
 *             return self._mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, x0=x0,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1106
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM_det.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1051
 * 
 * 
 *     def FIM_det(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, eps=None, measurement_error=1e-2,
 *                 inter_steps=100):
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_38FIM_det(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_eps, PyObject *__pyx_v_measurement_error, PyObject *__pyx_v_inter_steps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *__pyx_cur_scope;
  PyObject *__pyx_v_infer_result_loc = NULL;
  PyObject *__pyx_v_flat_params = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_mean = 0;
  PyObject *__pyx_v_xx = NULL;
  PyObject *__pyx_v_fx = NULL;
  PyObject *__pyx_v_sigma_sq = NULL;
  PyObject *__pyx_v_cov_diag = NULL;
  PyObject *__pyx_v_cov = NULL;
  PyObject *__pyx_v_invcov = NULL;
  Py_ssize_t __pyx_v_dim;
  PyObject *__pyx_v_FIM_det = NULL;
  PyObject *__pyx_v_dmu = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_rows = NULL;
  PyObject *__pyx_v_cols = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_i_lower = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  __Pyx_RefNannySetupContext("FIM_det", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_1_FIM_det(__pyx_ptype_6pyross_9inference___pyx_scope_struct_1_FIM_det, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1051, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_Tf = __pyx_v_Tf;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Tf);
  __pyx_cur_scope->__pyx_v_contactMatrix = __pyx_v_contactMatrix;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __pyx_cur_scope->__pyx_v_generator = __pyx_v_generator;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
  __pyx_cur_scope->__pyx_v_intervention_fun = __pyx_v_intervention_fun;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __pyx_cur_scope->__pyx_v_inter_steps = __pyx_v_inter_steps;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_INCREF(__pyx_v_eps);

  /* "pyross/inference.pyx":1091
 *         '''
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         infer_result_loc = infer_result.copy()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_generator);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_cur_scope->__pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1093
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 * 
 *         infer_result_loc = infer_result.copy()             # <<<<<<<<<<<<<<
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_infer_result_loc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1095
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_flat_map, __pyx_v_infer_result_loc, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":1096
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')             # <<<<<<<<<<<<<<
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result_loc, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_n_u_flat_map) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_flat_map);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params, __pyx_t_1) < 0)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1095
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  }

  /* "pyross/inference.pyx":1098
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])             # <<<<<<<<<<<<<<
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_flat_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1099
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 *         kwargs = {}             # <<<<<<<<<<<<<<
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses']:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1100
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]
 */
  __pyx_t_1 = __pyx_tuple__9; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= 4) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1100, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1102
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]             # <<<<<<<<<<<<<<
 * 
 *         x0 = x[0]
 */
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_v_key, __pyx_t_5) < 0)) __PYX_ERR(0, 1102, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1100
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1104
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         x0 = x[0]             # <<<<<<<<<<<<<<
 * 
 *         def mean(y):
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_x0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1106
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_7FIM_det_1mean, 0, __pyx_n_s_FIM_det_locals_mean, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mean = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1113
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_eps, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":1114
 * 
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']             # <<<<<<<<<<<<<<
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_xx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1115
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])             # <<<<<<<<<<<<<<
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_log_likelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1116
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)             # <<<<<<<<<<<<<<
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 */
    __pyx_t_2 = PyNumber_Multiply(__pyx_int_100, __pyx_v_xx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_divide); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_spacing); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_fx) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_fx);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_5, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_5, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_fx);
      __Pyx_GIVEREF(__pyx_v_fx);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_v_fx);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_float_0_25, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1113
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
    goto __pyx_L6;
  }

  /* "pyross/inference.pyx":1118
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isscalar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_eps) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_eps);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":1119
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))             # <<<<<<<<<<<<<<
 *         print('eps-vector used for differentiation: ', eps)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_repeat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_eps);
    __Pyx_GIVEREF(__pyx_v_eps);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_eps);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1119, __pyx_L1_error)
    __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_repeats, __pyx_t_9) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":1118
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  }
  __pyx_L6:;

  /* "pyross/inference.pyx":1120
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)             # <<<<<<<<<<<<<<
 * 
 *         sigma_sq = measurement_error*measurement_error
 */
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_GIVEREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_eps);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1122
 *         print('eps-vector used for differentiation: ', eps)
 * 
 *         sigma_sq = measurement_error*measurement_error             # <<<<<<<<<<<<<<
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(x.shape[0]-1)))
 *         cov = np.diag(cov_diag)
 */
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_measurement_error, __pyx_v_measurement_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_sigma_sq = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1123
 * 
 *         sigma_sq = measurement_error*measurement_error
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(x.shape[0]-1)))             # <<<<<<<<<<<<<<
 *         cov = np.diag(cov_diag)
 *         invcov = np.linalg.inv(cov)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_repeat); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_sigma_sq);
  __Pyx_GIVEREF(__pyx_v_sigma_sq);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_sigma_sq);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_repeats, __pyx_t_10) < 0) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cov_diag = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1124
 *         sigma_sq = measurement_error*measurement_error
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(x.shape[0]-1)))
 *         cov = np.diag(cov_diag)             # <<<<<<<<<<<<<<
 *         invcov = np.linalg.inv(cov)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_diag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_10 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_cov_diag) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cov_diag);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_cov = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1125
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(x.shape[0]-1)))
 *         cov = np.diag(cov_diag)
 *         invcov = np.linalg.inv(cov)             # <<<<<<<<<<<<<<
 * 
 *         dim = len(flat_params)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linalg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_10 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_cov) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cov);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_invcov = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1127
 *         invcov = np.linalg.inv(cov)
 * 
 *         dim = len(flat_params)             # <<<<<<<<<<<<<<
 *         FIM_det = np.empty((dim,dim))
 *         dmu = []
 */
  __pyx_t_8 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1127, __pyx_L1_error)
  __pyx_v_dim = __pyx_t_8;

  /* "pyross/inference.pyx":1128
 * 
 *         dim = len(flat_params)
 *         FIM_det = np.empty((dim,dim))             # <<<<<<<<<<<<<<
 *         dmu = []
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
  __pyx_t_3 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_FIM_det = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1129
 *         dim = len(flat_params)
 *         FIM_det = np.empty((dim,dim))
 *         dmu = []             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
  __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v_dmu = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1131
 *         dmu = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 */
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1131, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_10))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1131, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1131, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_11(__pyx_t_10);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1131, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1132
 * 
 *         for i in range(dim):
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_partial_derivative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mean);
    __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_var, __pyx_v_i) < 0) __PYX_ERR(0, 1132, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_point, __pyx_v_flat_params) < 0) __PYX_ERR(0, 1132, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_eps, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dx, __pyx_t_3) < 0) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_dmu, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1131
 *         dmu = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1134
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]
 * 
 */
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_10 = __pyx_t_3; __Pyx_INCREF(__pyx_t_10); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1134, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_10))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_11(__pyx_t_10);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1134, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1135
 * 
 *         for i in range(dim):
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]             # <<<<<<<<<<<<<<
 * 
 *         rows,cols = np.triu_indices(dim,1)
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_3, __pyx_v_invcov); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM_det, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1134
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1137
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]
 * 
 *         rows,cols = np.triu_indices(dim,1)             # <<<<<<<<<<<<<<
 * 
 *         for i,j in zip(rows,cols):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_triu_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_2, __pyx_int_1};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_2, __pyx_int_1};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
    PyObject* sequence = __pyx_t_10;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1137, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_2), 2) < 0) __PYX_ERR(0, 1137, __pyx_L1_error)
    __pyx_t_13 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1137, __pyx_L1_error)
    __pyx_L12_unpacking_done:;
  }
  __pyx_v_rows = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_cols = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1139
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]
 * 
 */
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_rows);
  __Pyx_GIVEREF(__pyx_v_rows);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_rows);
  __Pyx_INCREF(__pyx_v_cols);
  __Pyx_GIVEREF(__pyx_v_cols);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_cols);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1139, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_10))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1139, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1139, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_11(__pyx_t_10);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1139, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1139, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_13(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_2 = __pyx_t_13(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_9), 2) < 0) __PYX_ERR(0, 1139, __pyx_L1_error)
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1139, __pyx_L1_error)
      __pyx_L16_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1140
 * 
 *         for i,j in zip(rows,cols):
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]             # <<<<<<<<<<<<<<
 * 
 *         i_lower = np.tril_indices(dim,-1)
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_v_invcov); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_j);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM_det, __pyx_t_1, __pyx_t_3) < 0)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1139
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1142
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]
 * 
 *         i_lower = np.tril_indices(dim,-1)             # <<<<<<<<<<<<<<
 *         FIM_det[i_lower] = FIM_det.T[i_lower]
 *         return FIM_det
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tril_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_int_neg_1};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1142, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_int_neg_1};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1142, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_t_3);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_int_neg_1);
    __pyx_t_3 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_i_lower = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1143
 * 
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM_det[i_lower] = FIM_det.T[i_lower]             # <<<<<<<<<<<<<<
 *         return FIM_det
 * 
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_FIM_det, __pyx_n_s_T); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_v_i_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_FIM_det, __pyx_v_i_lower, __pyx_t_1) < 0)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1144
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM_det[i_lower] = FIM_det.T[i_lower]
 *         return FIM_det             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_FIM_det);
  __pyx_r = __pyx_v_FIM_det;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1051
 * 
 * 
 *     def FIM_det(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, eps=None, measurement_error=1e-2,
 *                 inter_steps=100):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type.FIM_det", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_infer_result_loc);
  __Pyx_XDECREF(__pyx_v_flat_params);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_fx);
  __Pyx_XDECREF(__pyx_v_sigma_sq);
  __Pyx_XDECREF(__pyx_v_cov_diag);
  __Pyx_XDECREF(__pyx_v_cov);
  __Pyx_XDECREF(__pyx_v_invcov);
  __Pyx_XDECREF(__pyx_v_FIM_det);
  __Pyx_XDECREF(__pyx_v_dmu);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_i_lower);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1147
 * 
 * 
 *     def hessian(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, tangent=False, eps=None,
 *                 fd_method="central", inter_steps=0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_41hessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_40hessian[] = "\n        Computes the Hessian matrix for the MAP estimates of an SIR type model.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        eps: float or numpy.array, optional\n            Step size for finite differences computation of the hessian with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result['flat_params'])`. If not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_posterior']),infer_result['log_posterior'])**(0.25)` is used. For `fd_method=\"central\"` it is recommended to use a step-size ""greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        fd_method: str, optional\n            The type of finite-difference scheme used to compute the hessian, supports \"forward\" and \"central\". Default is \"central\".\n        inter_steps: int, optional\n            Only used if `tangent=False`. Intermediate steps for interpolation between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but sometimes more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 0.\n        Returns\n        -------\n        hess: 2d numpy.array\n            The Hessian matrix\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_41hessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_fd_method = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hessian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_eps,&__pyx_n_s_fd_method,&__pyx_n_s_inter_steps,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1148
 * 
 *     def hessian(self, x, Tf, infer_result, contactMatrix=None, generator=None,
 *                 intervention_fun=None, tangent=False, eps=None,             # <<<<<<<<<<<<<<
 *                 fd_method="central", inter_steps=0):
 *         '''
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_False);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)__pyx_n_u_central);
    values[9] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hessian", 0, 3, 10, 1); __PYX_ERR(0, 1147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hessian", 0, 3, 10, 2); __PYX_ERR(0, 1147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fd_method);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hessian") < 0)) __PYX_ERR(0, 1147, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_infer_result = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_eps = values[7];
    __pyx_v_fd_method = values[8];
    __pyx_v_inter_steps = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hessian", 0, 3, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.hessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_40hessian(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":1147
 * 
 * 
 *     def hessian(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, tangent=False, eps=None,
 *                 fd_method="central", inter_steps=0):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1211
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7hessian_1minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_7hessian_1minuslogp = {"minuslogp", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_7hessian_1minuslogp, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7hessian_1minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minuslogp (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_7hessian_minuslogp(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_7hessian_minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("minuslogp", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":1212
 * 
 *         def minuslogp(y):
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)             # <<<<<<<<<<<<<<
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 *         return hess
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1212, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_infer_to_minimize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_x)) { __Pyx_RaiseClosureNameError("x"); __PYX_ERR(0, 1212, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x, __pyx_cur_scope->__pyx_v_x) < 0) __PYX_ERR(0, 1212, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 1212, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 1212, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_tangent)) { __Pyx_RaiseClosureNameError("tangent"); __PYX_ERR(0, 1212, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tangent, __pyx_cur_scope->__pyx_v_tangent) < 0) __PYX_ERR(0, 1212, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 1212, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 1212, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 1212, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1211
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.hessian.minuslogp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1147
 * 
 * 
 *     def hessian(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, tangent=False, eps=None,
 *                 fd_method="central", inter_steps=0):
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_40hessian(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *__pyx_cur_scope;
  PyObject *__pyx_v_flat_params = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_xx = NULL;
  PyObject *__pyx_v_fx = NULL;
  PyObject *__pyx_v_minuslogp = 0;
  PyObject *__pyx_v_hess = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("hessian", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_2_hessian(__pyx_ptype_6pyross_9inference___pyx_scope_struct_2_hessian, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1147, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_x = __pyx_v_x;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x);
  __pyx_cur_scope->__pyx_v_Tf = __pyx_v_Tf;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Tf);
  __pyx_cur_scope->__pyx_v_tangent = __pyx_v_tangent;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tangent);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tangent);
  __Pyx_INCREF(__pyx_v_eps);

  /* "pyross/inference.pyx":1189
 *         '''
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         flat_params = np.copy(infer_result['flat_params'])
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1191
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 * 
 *         flat_params = np.copy(infer_result['flat_params'])             # <<<<<<<<<<<<<<
 * 
 *         kwargs = {}
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_flat_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1193
 *         flat_params = np.copy(infer_result['flat_params'])
 * 
 *         kwargs = {}             # <<<<<<<<<<<<<<
 *         for key in ['is_scale_parameter',
 *                     'scaled_param_guesses', 'prior']:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1194
 * 
 *         kwargs = {}
 *         for key in ['is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'prior']:
 *             kwargs[key] = infer_result[key]
 */
  __pyx_t_1 = __pyx_tuple__16; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= 3) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1194, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1196
 *         for key in ['is_scale_parameter',
 *                     'scaled_param_guesses', 'prior']:
 *             kwargs[key] = infer_result[key]             # <<<<<<<<<<<<<<
 * 
 *         kwargs['keys'] = infer_result['param_keys']
 */
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_v_key, __pyx_t_5) < 0)) __PYX_ERR(0, 1196, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1194
 * 
 *         kwargs = {}
 *         for key in ['is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'prior']:
 *             kwargs[key] = infer_result[key]
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1198
 *             kwargs[key] = infer_result[key]
 * 
 *         kwargs['keys'] = infer_result['param_keys']             # <<<<<<<<<<<<<<
 *         kwargs['flat_guess_range'] = infer_result['param_guess_range']
 *         kwargs['generator'] = generator
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_param_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_keys, __pyx_t_1) < 0)) __PYX_ERR(0, 1198, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1199
 * 
 *         kwargs['keys'] = infer_result['param_keys']
 *         kwargs['flat_guess_range'] = infer_result['param_guess_range']             # <<<<<<<<<<<<<<
 *         kwargs['generator'] = generator
 *         kwargs['intervention_fun'] = intervention_fun
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_param_guess_range); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_flat_guess_range, __pyx_t_1) < 0)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1200
 *         kwargs['keys'] = infer_result['param_keys']
 *         kwargs['flat_guess_range'] = infer_result['param_guess_range']
 *         kwargs['generator'] = generator             # <<<<<<<<<<<<<<
 *         kwargs['intervention_fun'] = intervention_fun
 *         kwargs['inter_steps'] = inter_steps
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_generator, __pyx_v_generator) < 0)) __PYX_ERR(0, 1200, __pyx_L1_error)

  /* "pyross/inference.pyx":1201
 *         kwargs['flat_guess_range'] = infer_result['param_guess_range']
 *         kwargs['generator'] = generator
 *         kwargs['intervention_fun'] = intervention_fun             # <<<<<<<<<<<<<<
 *         kwargs['inter_steps'] = inter_steps
 * 
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0)) __PYX_ERR(0, 1201, __pyx_L1_error)

  /* "pyross/inference.pyx":1202
 *         kwargs['generator'] = generator
 *         kwargs['intervention_fun'] = intervention_fun
 *         kwargs['inter_steps'] = inter_steps             # <<<<<<<<<<<<<<
 * 
 *         if np.all(eps == None):
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_inter_steps, __pyx_v_inter_steps) < 0)) __PYX_ERR(0, 1202, __pyx_L1_error)

  /* "pyross/inference.pyx":1204
 *         kwargs['inter_steps'] = inter_steps
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_eps, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":1205
 * 
 *         if np.all(eps == None):
 *             xx = infer_result['flat_params']             # <<<<<<<<<<<<<<
 *             fx = abs(infer_result['log_posterior'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_xx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1206
 *         if np.all(eps == None):
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])             # <<<<<<<<<<<<<<
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_log_posterior); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1207
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)             # <<<<<<<<<<<<<<
 *             #eps = 10.*np.spacing(flat_params)**(0.25)
 *         print('epsilon used for differentiation: ', eps)
 */
    __pyx_t_2 = PyNumber_Multiply(__pyx_int_100, __pyx_v_xx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_divide); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_spacing); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_v_fx) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_fx);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_5, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_5, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_fx);
      __Pyx_GIVEREF(__pyx_v_fx);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_v_fx);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_float_0_25, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1204
 *         kwargs['inter_steps'] = inter_steps
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])
 */
  }

  /* "pyross/inference.pyx":1209
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**(0.25)
 *         print('epsilon used for differentiation: ', eps)             # <<<<<<<<<<<<<<
 * 
 *         def minuslogp(y):
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_u_epsilon_used_for_differentiation);
  __Pyx_GIVEREF(__pyx_kp_u_epsilon_used_for_differentiation);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_epsilon_used_for_differentiation);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_eps);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1211
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_7hessian_1minuslogp, 0, __pyx_n_s_hessian_locals_minuslogp, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_minuslogp = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1213
 *         def minuslogp(y):
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)             # <<<<<<<<<<<<<<
 *         return hess
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_hessian_finite_difference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_flat_params);
  __Pyx_GIVEREF(__pyx_v_flat_params);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flat_params);
  __Pyx_INCREF(__pyx_v_minuslogp);
  __Pyx_GIVEREF(__pyx_v_minuslogp);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_minuslogp);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_eps);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_method, __pyx_v_fd_method) < 0) __PYX_ERR(0, 1213, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_hess = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1214
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 *         return hess             # <<<<<<<<<<<<<<
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_hess);
  __pyx_r = __pyx_v_hess;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1147
 * 
 * 
 *     def hessian(self, x, Tf, infer_result, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, tangent=False, eps=None,
 *                 fd_method="central", inter_steps=0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SIR_type.hessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_flat_params);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_fx);
  __Pyx_XDECREF(__pyx_v_minuslogp);
  __Pyx_XDECREF(__pyx_v_hess);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1216
 *         return hess
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,             # <<<<<<<<<<<<<<
 *                    range_1, range_2, resolution_1, resolution_2=None):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_43robustness(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_42robustness[] = "\n        Robustness analysis in a two-dimensional slice of the parameter space, revealing neutral spaces as in https://doi.org/10.1073/pnas.1015814108.\n\n        Parameters\n        ----------\n        FIM: 2d numpy.array\n            Fisher Information matrix of a stochastic model\n        FIM_det: 2d numpy.array\n            Fisher information matrix of the corresponding deterministic model\n        infer_result: dict\n            Dictionary returned by `latent_infer`\n        param_pos_1: int\n            Position of 'parameter 1' in map_dict['flat_map'] for x-axis\n        param_pos_2: int\n            Position of 'parameter 2' in map_dict['flat_map'] for y-axis\n        range_1: float\n            Symmetric interval around parameter 1 for which robustness will be analysed. Absolute interval: 'parameter 1' +/- range_1\n        range_2: float\n            Symmetric interval around parameter 2 for which robustness will be analysed. Absolute interval: 'parameter 2' +/- range_2\n        resolution_1: int\n            Resolution of the meshgrid in x direction.\n        resolution_2: int\n            Resolution of the meshgrid in y direction. Default is resolution_2=resolution_1.\n        Returns\n        -------\n        ff: 2d numpy.array\n            shape=resolution_1 x resolution_2, meshgrid for x-axis\n        ss: 2d numpy.array\n            shape=resolution_1 x resolution_2, meshgrid for y-axis\n        Z_sto: 2d numpy.array\n            shape=resolution_1 x resolution_2, expected quadratic coefficient in the Taylor expansion of the likelihood of the stochastic model\n        Z_det: 2d numpy.array\n            shape=resolution_1 x resolution_2, expected quadratic coefficient in the Taylor expansion of the likelihood of the deterministic model\n\n        Examples\n        --------\n        >>> from matplotlib import pyplot as plt\n        >>> from matplotlib import cm\n        >>>\n        >>> # positions 0 and 1 of infer_result['flat_params'] correspond to a ""scale parameter for alpha, and beta, respectively.\n        >>> ff, ss, Z_sto, Z_det = estimator.robustness(FIM, FIM_det, map_dict, 0, 1, 0.5, 0.01, 20)\n        >>> cmap = plt.cm.PuBu_r\n        >>> levels=11\n        >>> colors='black'\n        >>>\n        >>> c = plt.contourf(ff, ss, Z_sto, cmap=cmap, levels=levels) # heat map for the stochastic coefficient\n        >>> plt.contour(ff, ss, Z_sto, colors='black', levels=levels, linewidths=0.25)\n        >>> plt.contour(ff, ss, Z_det, colors=colors, levels=levels) # contour plot for the deterministic model\n        >>> plt.plot(infer_result['flat_params'][0], infer_result['flat_params'][1], 'o',\n                    color=\"#A60628\", markersize=6) # the MAP estimate\n        >>> plt.colorbar(c)\n        >>> plt.xlabel(r'$\007lpha$ scale', fontsize=20, labelpad=10)\n        >>> plt.ylabel(r'$\010eta$', fontsize=20, labelpad=10)\n        >>> plt.show()\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_43robustness(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_FIM = 0;
  PyObject *__pyx_v_FIM_det = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_param_pos_1 = 0;
  PyObject *__pyx_v_param_pos_2 = 0;
  PyObject *__pyx_v_range_1 = 0;
  PyObject *__pyx_v_range_2 = 0;
  PyObject *__pyx_v_resolution_1 = 0;
  PyObject *__pyx_v_resolution_2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("robustness (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_FIM,&__pyx_n_s_FIM_det,&__pyx_n_s_infer_result,&__pyx_n_s_param_pos_1,&__pyx_n_s_param_pos_2,&__pyx_n_s_range_1,&__pyx_n_s_range_2,&__pyx_n_s_resolution_1,&__pyx_n_s_resolution_2,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":1217
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,
 *                    range_1, range_2, resolution_1, resolution_2=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Robustness analysis in a two-dimensional slice of the parameter space, revealing neutral spaces as in https://doi.org/10.1073/pnas.1015814108.
 */
    values[8] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_FIM)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_FIM_det)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 1); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 2); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_pos_1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 3); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_pos_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 4); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 5); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 6); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resolution_1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, 7); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resolution_2);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "robustness") < 0)) __PYX_ERR(0, 1216, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_FIM = values[0];
    __pyx_v_FIM_det = values[1];
    __pyx_v_infer_result = values[2];
    __pyx_v_param_pos_1 = values[3];
    __pyx_v_param_pos_2 = values[4];
    __pyx_v_range_1 = values[5];
    __pyx_v_range_2 = values[6];
    __pyx_v_resolution_1 = values[7];
    __pyx_v_resolution_2 = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("robustness", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.robustness", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_42robustness(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_FIM, __pyx_v_FIM_det, __pyx_v_infer_result, __pyx_v_param_pos_1, __pyx_v_param_pos_2, __pyx_v_range_1, __pyx_v_range_2, __pyx_v_resolution_1, __pyx_v_resolution_2);

  /* "pyross/inference.pyx":1216
 *         return hess
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,             # <<<<<<<<<<<<<<
 *                    range_1, range_2, resolution_1, resolution_2=None):
 *         '''
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1281
 *         if resolution_2 == None:
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):             # <<<<<<<<<<<<<<
 *             maps_temp = np.copy(flat_maps)
 *             maps_temp[param_pos_1] += param_1
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10robustness_1bilinear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_10robustness_1bilinear = {"bilinear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_10robustness_1bilinear, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10robustness_1bilinear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_param_1 = 0;
  PyObject *__pyx_v_param_2 = 0;
  PyObject *__pyx_v_det = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bilinear (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_param_1,&__pyx_n_s_param_2,&__pyx_n_s_det,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bilinear", 0, 2, 3, 1); __PYX_ERR(0, 1281, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bilinear") < 0)) __PYX_ERR(0, 1281, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_param_1 = values[0];
    __pyx_v_param_2 = values[1];
    __pyx_v_det = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bilinear", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1281, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.robustness.bilinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_10robustness_bilinear(__pyx_self, __pyx_v_param_1, __pyx_v_param_2, __pyx_v_det);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10robustness_bilinear(PyObject *__pyx_self, PyObject *__pyx_v_param_1, PyObject *__pyx_v_param_2, PyObject *__pyx_v_det) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *__pyx_outer_scope;
  PyObject *__pyx_v_maps_temp = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("bilinear", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":1282
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):
 *             maps_temp = np.copy(flat_maps)             # <<<<<<<<<<<<<<
 *             maps_temp[param_pos_1] += param_1
 *             maps_temp[param_pos_2] += param_2
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_flat_maps)) { __Pyx_RaiseClosureNameError("flat_maps"); __PYX_ERR(0, 1282, __pyx_L1_error) }
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_cur_scope->__pyx_v_flat_maps) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_flat_maps);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_maps_temp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1283
 *         def bilinear(param_1, param_2, det=True):
 *             maps_temp = np.copy(flat_maps)
 *             maps_temp[param_pos_1] += param_1             # <<<<<<<<<<<<<<
 *             maps_temp[param_pos_2] += param_2
 *             dev = maps_temp - flat_maps
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_param_pos_1)) { __Pyx_RaiseClosureNameError("param_pos_1"); __PYX_ERR(0, 1283, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_param_pos_1);
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_param_pos_1;
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_maps_temp, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_v_param_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_maps_temp, __pyx_t_1, __pyx_t_2) < 0)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1284
 *             maps_temp = np.copy(flat_maps)
 *             maps_temp[param_pos_1] += param_1
 *             maps_temp[param_pos_2] += param_2             # <<<<<<<<<<<<<<
 *             dev = maps_temp - flat_maps
 *             if det:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_param_pos_2)) { __Pyx_RaiseClosureNameError("param_pos_2"); __PYX_ERR(0, 1284, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_param_pos_2);
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_param_pos_2;
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_maps_temp, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_v_param_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_maps_temp, __pyx_t_1, __pyx_t_3) < 0)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1285
 *             maps_temp[param_pos_1] += param_1
 *             maps_temp[param_pos_2] += param_2
 *             dev = maps_temp - flat_maps             # <<<<<<<<<<<<<<
 *             if det:
 *                 return -dev@FIM_det@dev
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_flat_maps)) { __Pyx_RaiseClosureNameError("flat_maps"); __PYX_ERR(0, 1285, __pyx_L1_error) }
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_maps_temp, __pyx_cur_scope->__pyx_v_flat_maps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_dev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1286
 *             maps_temp[param_pos_2] += param_2
 *             dev = maps_temp - flat_maps
 *             if det:             # <<<<<<<<<<<<<<
 *                 return -dev@FIM_det@dev
 *             else:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_det); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1286, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "pyross/inference.pyx":1287
 *             dev = maps_temp - flat_maps
 *             if det:
 *                 return -dev@FIM_det@dev             # <<<<<<<<<<<<<<
 *             else:
 *                 return -dev@FIM@dev
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyNumber_Negative(__pyx_v_dev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(!__pyx_cur_scope->__pyx_v_FIM_det)) { __Pyx_RaiseClosureNameError("FIM_det"); __PYX_ERR(0, 1287, __pyx_L1_error) }
    __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_FIM_det); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_3, __pyx_v_dev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pyross/inference.pyx":1286
 *             maps_temp[param_pos_2] += param_2
 *             dev = maps_temp - flat_maps
 *             if det:             # <<<<<<<<<<<<<<
 *                 return -dev@FIM_det@dev
 *             else:
 */
  }

  /* "pyross/inference.pyx":1289
 *                 return -dev@FIM_det@dev
 *             else:
 *                 return -dev@FIM@dev             # <<<<<<<<<<<<<<
 *         param_1_range = np.linspace(-range_1, range_1, resolution_1)
 *         param_2_range = np.linspace(-range_2, range_2, resolution_2)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyNumber_Negative(__pyx_v_dev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(!__pyx_cur_scope->__pyx_v_FIM)) { __Pyx_RaiseClosureNameError("FIM"); __PYX_ERR(0, 1289, __pyx_L1_error) }
    __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_FIM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_3, __pyx_v_dev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "pyross/inference.pyx":1281
 *         if resolution_2 == None:
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):             # <<<<<<<<<<<<<<
 *             maps_temp = np.copy(flat_maps)
 *             maps_temp[param_pos_1] += param_1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SIR_type.robustness.bilinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_maps_temp);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1216
 *         return hess
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,             # <<<<<<<<<<<<<<
 *                    range_1, range_2, resolution_1, resolution_2=None):
 *         '''
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_42robustness(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_FIM, PyObject *__pyx_v_FIM_det, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_param_pos_1, PyObject *__pyx_v_param_pos_2, PyObject *__pyx_v_range_1, PyObject *__pyx_v_range_2, PyObject *__pyx_v_resolution_1, PyObject *__pyx_v_resolution_2) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *__pyx_cur_scope;
  PyObject *__pyx_v_infer_result_loc = NULL;
  PyObject *__pyx_v_bilinear = 0;
  PyObject *__pyx_v_param_1_range = NULL;
  PyObject *__pyx_v_param_2_range = NULL;
  PyObject *__pyx_v_ff = NULL;
  PyObject *__pyx_v_ss = NULL;
  PyObject *__pyx_v_Z_sto = NULL;
  PyObject *__pyx_v_Z_det = NULL;
  PyObject *__pyx_v_i_k = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j_k = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  __Pyx_RefNannySetupContext("robustness", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_3_robustness(__pyx_ptype_6pyross_9inference___pyx_scope_struct_3_robustness, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1216, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_FIM = __pyx_v_FIM;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_FIM);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_FIM);
  __pyx_cur_scope->__pyx_v_FIM_det = __pyx_v_FIM_det;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_FIM_det);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_FIM_det);
  __pyx_cur_scope->__pyx_v_param_pos_1 = __pyx_v_param_pos_1;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_param_pos_1);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_param_pos_1);
  __pyx_cur_scope->__pyx_v_param_pos_2 = __pyx_v_param_pos_2;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_param_pos_2);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_param_pos_2);
  __Pyx_INCREF(__pyx_v_resolution_2);

  /* "pyross/inference.pyx":1273
 *         >>> plt.show()
 *         '''
 *         infer_result_loc = infer_result.copy()             # <<<<<<<<<<<<<<
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_infer_result_loc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1275
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_flat_map, __pyx_v_infer_result_loc, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "pyross/inference.pyx":1276
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')             # <<<<<<<<<<<<<<
 * 
 *         flat_maps = infer_result_loc['flat_params']
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result_loc, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_u_flat_map) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_flat_map);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params, __pyx_t_1) < 0)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":1275
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  }

  /* "pyross/inference.pyx":1278
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 *         flat_maps = infer_result_loc['flat_params']             # <<<<<<<<<<<<<<
 *         if resolution_2 == None:
 *             resolution_2 = resolution_1
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_flat_maps = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1279
 * 
 *         flat_maps = infer_result_loc['flat_params']
 *         if resolution_2 == None:             # <<<<<<<<<<<<<<
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_resolution_2, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pyross/inference.pyx":1280
 *         flat_maps = infer_result_loc['flat_params']
 *         if resolution_2 == None:
 *             resolution_2 = resolution_1             # <<<<<<<<<<<<<<
 *         def bilinear(param_1, param_2, det=True):
 *             maps_temp = np.copy(flat_maps)
 */
    __Pyx_INCREF(__pyx_v_resolution_1);
    __Pyx_DECREF_SET(__pyx_v_resolution_2, __pyx_v_resolution_1);

    /* "pyross/inference.pyx":1279
 * 
 *         flat_maps = infer_result_loc['flat_params']
 *         if resolution_2 == None:             # <<<<<<<<<<<<<<
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):
 */
  }

  /* "pyross/inference.pyx":1281
 *         if resolution_2 == None:
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):             # <<<<<<<<<<<<<<
 *             maps_temp = np.copy(flat_maps)
 *             maps_temp[param_pos_1] += param_1
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_10robustness_1bilinear, 0, __pyx_n_s_robustness_locals_bilinear, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__21);
  __pyx_v_bilinear = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1290
 *             else:
 *                 return -dev@FIM@dev
 *         param_1_range = np.linspace(-range_1, range_1, resolution_1)             # <<<<<<<<<<<<<<
 *         param_2_range = np.linspace(-range_2, range_2, resolution_2)
 *         ff, ss = np.meshgrid(flat_maps[param_pos_1] + param_1_range,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Negative(__pyx_v_range_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_2, __pyx_v_range_1, __pyx_v_resolution_1};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_2, __pyx_v_range_1, __pyx_v_resolution_1};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_range_1);
    __Pyx_GIVEREF(__pyx_v_range_1);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_range_1);
    __Pyx_INCREF(__pyx_v_resolution_1);
    __Pyx_GIVEREF(__pyx_v_resolution_1);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_resolution_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_param_1_range = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1291
 *                 return -dev@FIM@dev
 *         param_1_range = np.linspace(-range_1, range_1, resolution_1)
 *         param_2_range = np.linspace(-range_2, range_2, resolution_2)             # <<<<<<<<<<<<<<
 *         ff, ss = np.meshgrid(flat_maps[param_pos_1] + param_1_range,
 *                             flat_maps[param_pos_2] + param_2_range)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Negative(__pyx_v_range_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_3, __pyx_v_range_2, __pyx_v_resolution_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_3, __pyx_v_range_2, __pyx_v_resolution_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_range_2);
    __Pyx_GIVEREF(__pyx_v_range_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_range_2);
    __Pyx_INCREF(__pyx_v_resolution_2);
    __Pyx_GIVEREF(__pyx_v_resolution_2);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_resolution_2);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_param_2_range = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1292
 *         param_1_range = np.linspace(-range_1, range_1, resolution_1)
 *         param_2_range = np.linspace(-range_2, range_2, resolution_2)
 *         ff, ss = np.meshgrid(flat_maps[param_pos_1] + param_1_range,             # <<<<<<<<<<<<<<
 *                             flat_maps[param_pos_2] + param_2_range)
 *         Z_sto = np.zeros((len(param_1_range), len(param_2_range)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_flat_maps, __pyx_cur_scope->__pyx_v_param_pos_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyNumber_Add(__pyx_t_8, __pyx_v_param_1_range); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1293
 *         param_2_range = np.linspace(-range_2, range_2, resolution_2)
 *         ff, ss = np.meshgrid(flat_maps[param_pos_1] + param_1_range,
 *                             flat_maps[param_pos_2] + param_2_range)             # <<<<<<<<<<<<<<
 *         Z_sto = np.zeros((len(param_1_range), len(param_2_range)))
 *         Z_det = np.zeros((len(param_1_range), len(param_2_range)))
 */
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_flat_maps, __pyx_cur_scope->__pyx_v_param_pos_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_v_param_2_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_3, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_3, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1292, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_9);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_9 = __pyx_t_10(__pyx_t_2); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_2), 2) < 0) __PYX_ERR(0, 1292, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1292, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }

  /* "pyross/inference.pyx":1292
 *         param_1_range = np.linspace(-range_1, range_1, resolution_1)
 *         param_2_range = np.linspace(-range_2, range_2, resolution_2)
 *         ff, ss = np.meshgrid(flat_maps[param_pos_1] + param_1_range,             # <<<<<<<<<<<<<<
 *                             flat_maps[param_pos_2] + param_2_range)
 *         Z_sto = np.zeros((len(param_1_range), len(param_2_range)))
 */
  __pyx_v_ff = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_ss = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1294
 *         ff, ss = np.meshgrid(flat_maps[param_pos_1] + param_1_range,
 *                             flat_maps[param_pos_2] + param_2_range)
 *         Z_sto = np.zeros((len(param_1_range), len(param_2_range)))             # <<<<<<<<<<<<<<
 *         Z_det = np.zeros((len(param_1_range), len(param_2_range)))
 *         i_k = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = PyObject_Length(__pyx_v_param_1_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1294, __pyx_L1_error)
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyObject_Length(__pyx_v_param_2_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1294, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_9 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_Z_sto = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1295
 *                             flat_maps[param_pos_2] + param_2_range)
 *         Z_sto = np.zeros((len(param_1_range), len(param_2_range)))
 *         Z_det = np.zeros((len(param_1_range), len(param_2_range)))             # <<<<<<<<<<<<<<
 *         i_k = 0
 *         for i in param_1_range:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_11 = PyObject_Length(__pyx_v_param_1_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1295, __pyx_L1_error)
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_11 = PyObject_Length(__pyx_v_param_2_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1295, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
  __pyx_t_6 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Z_det = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1296
 *         Z_sto = np.zeros((len(param_1_range), len(param_2_range)))
 *         Z_det = np.zeros((len(param_1_range), len(param_2_range)))
 *         i_k = 0             # <<<<<<<<<<<<<<
 *         for i in param_1_range:
 *             j_k = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_i_k = __pyx_int_0;

  /* "pyross/inference.pyx":1297
 *         Z_det = np.zeros((len(param_1_range), len(param_2_range)))
 *         i_k = 0
 *         for i in param_1_range:             # <<<<<<<<<<<<<<
 *             j_k = 0
 *             for j in param_2_range:
 */
  if (likely(PyList_CheckExact(__pyx_v_param_1_range)) || PyTuple_CheckExact(__pyx_v_param_1_range)) {
    __pyx_t_1 = __pyx_v_param_1_range; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_param_1_range); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1297, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1297, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1297, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1297, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1297, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_12(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1297, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1298
 *         i_k = 0
 *         for i in param_1_range:
 *             j_k = 0             # <<<<<<<<<<<<<<
 *             for j in param_2_range:
 *                 Z_det[i_k,j_k] = bilinear(i,j,det=True)
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_XDECREF_SET(__pyx_v_j_k, __pyx_int_0);

    /* "pyross/inference.pyx":1299
 *         for i in param_1_range:
 *             j_k = 0
 *             for j in param_2_range:             # <<<<<<<<<<<<<<
 *                 Z_det[i_k,j_k] = bilinear(i,j,det=True)
 *                 Z_sto[i_k,j_k] = bilinear(i,j,det=False)
 */
    if (likely(PyList_CheckExact(__pyx_v_param_2_range)) || PyTuple_CheckExact(__pyx_v_param_2_range)) {
      __pyx_t_3 = __pyx_v_param_2_range; __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_param_2_range); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_14 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1299, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1299, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1299, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1299, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1299, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        }
      } else {
        __pyx_t_9 = __pyx_t_14(__pyx_t_3);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1299, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":1300
 *             j_k = 0
 *             for j in param_2_range:
 *                 Z_det[i_k,j_k] = bilinear(i,j,det=True)             # <<<<<<<<<<<<<<
 *                 Z_sto[i_k,j_k] = bilinear(i,j,det=False)
 *                 j_k += 1
 */
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_j);
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_det, Py_True) < 0) __PYX_ERR(0, 1300, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_bilinear, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_i_k);
      __Pyx_GIVEREF(__pyx_v_i_k);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i_k);
      __Pyx_INCREF(__pyx_v_j_k);
      __Pyx_GIVEREF(__pyx_v_j_k);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_j_k);
      if (unlikely(PyObject_SetItem(__pyx_v_Z_det, __pyx_t_2, __pyx_t_6) < 0)) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pyross/inference.pyx":1301
 *             for j in param_2_range:
 *                 Z_det[i_k,j_k] = bilinear(i,j,det=True)
 *                 Z_sto[i_k,j_k] = bilinear(i,j,det=False)             # <<<<<<<<<<<<<<
 *                 j_k += 1
 *             i_k += 1
 */
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_i);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_j);
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_det, Py_False) < 0) __PYX_ERR(0, 1301, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_bilinear, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_i_k);
      __Pyx_GIVEREF(__pyx_v_i_k);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i_k);
      __Pyx_INCREF(__pyx_v_j_k);
      __Pyx_GIVEREF(__pyx_v_j_k);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_j_k);
      if (unlikely(PyObject_SetItem(__pyx_v_Z_sto, __pyx_t_2, __pyx_t_9) < 0)) __PYX_ERR(0, 1301, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pyross/inference.pyx":1302
 *                 Z_det[i_k,j_k] = bilinear(i,j,det=True)
 *                 Z_sto[i_k,j_k] = bilinear(i,j,det=False)
 *                 j_k += 1             # <<<<<<<<<<<<<<
 *             i_k += 1
 *         return ff, ss, Z_sto, Z_det
 */
      __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_j_k, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF_SET(__pyx_v_j_k, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":1299
 *         for i in param_1_range:
 *             j_k = 0
 *             for j in param_2_range:             # <<<<<<<<<<<<<<
 *                 Z_det[i_k,j_k] = bilinear(i,j,det=True)
 *                 Z_sto[i_k,j_k] = bilinear(i,j,det=False)
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1303
 *                 Z_sto[i_k,j_k] = bilinear(i,j,det=False)
 *                 j_k += 1
 *             i_k += 1             # <<<<<<<<<<<<<<
 *         return ff, ss, Z_sto, Z_det
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i_k, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_i_k, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1297
 *         Z_det = np.zeros((len(param_1_range), len(param_2_range)))
 *         i_k = 0
 *         for i in param_1_range:             # <<<<<<<<<<<<<<
 *             j_k = 0
 *             for j in param_2_range:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1304
 *                 j_k += 1
 *             i_k += 1
 *         return ff, ss, Z_sto, Z_det             # <<<<<<<<<<<<<<
 * 
 *     def sensitivity(self, FIM):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_ff);
  __Pyx_GIVEREF(__pyx_v_ff);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ff);
  __Pyx_INCREF(__pyx_v_ss);
  __Pyx_GIVEREF(__pyx_v_ss);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ss);
  __Pyx_INCREF(__pyx_v_Z_sto);
  __Pyx_GIVEREF(__pyx_v_Z_sto);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_Z_sto);
  __Pyx_INCREF(__pyx_v_Z_det);
  __Pyx_GIVEREF(__pyx_v_Z_det);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_Z_det);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1216
 *         return hess
 * 
 *     def robustness(self, FIM, FIM_det, infer_result, param_pos_1, param_pos_2,             # <<<<<<<<<<<<<<
 *                    range_1, range_2, resolution_1, resolution_2=None):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SIR_type.robustness", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_infer_result_loc);
  __Pyx_XDECREF(__pyx_v_bilinear);
  __Pyx_XDECREF(__pyx_v_param_1_range);
  __Pyx_XDECREF(__pyx_v_param_2_range);
  __Pyx_XDECREF(__pyx_v_ff);
  __Pyx_XDECREF(__pyx_v_ss);
  __Pyx_XDECREF(__pyx_v_Z_sto);
  __Pyx_XDECREF(__pyx_v_Z_det);
  __Pyx_XDECREF(__pyx_v_i_k);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j_k);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_resolution_2);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1306
 *         return ff, ss, Z_sto, Z_det
 * 
 *     def sensitivity(self, FIM):             # <<<<<<<<<<<<<<
 *         '''
 *         Computes sensitivity measures (not normalised) for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_45sensitivity(PyObject *__pyx_v_self, PyObject *__pyx_v_FIM); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_44sensitivity[] = "\n        Computes sensitivity measures (not normalised) for\n        1) each individual parameter: from the diagonal elements of the FIM\n        2) incorporating parametric interactions: from the standard deviations derived from the FIM\n        More on these interpretations can be found here: https://doi.org/10.1529/biophysj.104.053405\n        A larger entry translates into greater anticipated model sensitivity to changes in the parameter of interest.\n\n        Parameters\n        ----------\n        FIM: 2d numpy.array\n            The Fisher Information Matrix\n\n        Returns\n        -------\n        sensitivity_individual: numpy.array\n            Sensitivity measure for individual parameters.\n        sensitivity_correlated: numpy.array\n            Sensitivity measure incorporating parametric interactions.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_45sensitivity(PyObject *__pyx_v_self, PyObject *__pyx_v_FIM) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sensitivity (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_44sensitivity(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyObject *)__pyx_v_FIM));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_44sensitivity(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_FIM) {
  PyObject *__pyx_v_sensitivity_individual = NULL;
  PyObject *__pyx_v_sensitivity_correlated = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("sensitivity", 0);

  /* "pyross/inference.pyx":1326
 *             Sensitivity measure incorporating parametric interactions.
 *         '''
 *         if not np.all(np.linalg.eigvalsh(FIM)>0):             # <<<<<<<<<<<<<<
 *             raise Exception("FIM not positive definite - check for appropriate step-size `eps` in FIM computation and/or increase `inter_steps` for a more stable result")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linalg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_eigvalsh); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_FIM) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_FIM);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = ((!__pyx_t_6) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "pyross/inference.pyx":1327
 *         '''
 *         if not np.all(np.linalg.eigvalsh(FIM)>0):
 *             raise Exception("FIM not positive definite - check for appropriate step-size `eps` in FIM computation and/or increase `inter_steps` for a more stable result")             # <<<<<<<<<<<<<<
 * 
 *         sensitivity_individual = np.sqrt(np.diagonal(FIM))
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1327, __pyx_L1_error)

    /* "pyross/inference.pyx":1326
 *             Sensitivity measure incorporating parametric interactions.
 *         '''
 *         if not np.all(np.linalg.eigvalsh(FIM)>0):             # <<<<<<<<<<<<<<
 *             raise Exception("FIM not positive definite - check for appropriate step-size `eps` in FIM computation and/or increase `inter_steps` for a more stable result")
 * 
 */
  }

  /* "pyross/inference.pyx":1329
 *             raise Exception("FIM not positive definite - check for appropriate step-size `eps` in FIM computation and/or increase `inter_steps` for a more stable result")
 * 
 *         sensitivity_individual = np.sqrt(np.diagonal(FIM))             # <<<<<<<<<<<<<<
 *         sensitivity_correlated = np.divide(1, np.sqrt(np.diagonal(np.linalg.inv(FIM))))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_diagonal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_FIM) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_FIM);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_sensitivity_individual = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1330
 * 
 *         sensitivity_individual = np.sqrt(np.diagonal(FIM))
 *         sensitivity_correlated = np.divide(1, np.sqrt(np.diagonal(np.linalg.inv(FIM))))             # <<<<<<<<<<<<<<
 * 
 *         return sensitivity_individual, sensitivity_correlated
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_divide); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_diagonal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_linalg); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_inv); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_8 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_v_FIM) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_FIM);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_int_1, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_int_1, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sensitivity_correlated = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1332
 *         sensitivity_correlated = np.divide(1, np.sqrt(np.diagonal(np.linalg.inv(FIM))))
 * 
 *         return sensitivity_individual, sensitivity_correlated             # <<<<<<<<<<<<<<
 * 
 *     def sample_gaussian(self, N, map_estimate, cov, x, Tf, contactMatrix, prior_dict, tangent=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_sensitivity_individual);
  __Pyx_GIVEREF(__pyx_v_sensitivity_individual);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sensitivity_individual);
  __Pyx_INCREF(__pyx_v_sensitivity_correlated);
  __Pyx_GIVEREF(__pyx_v_sensitivity_correlated);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_sensitivity_correlated);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1306
 *         return ff, ss, Z_sto, Z_det
 * 
 *     def sensitivity(self, FIM):             # <<<<<<<<<<<<<<
 *         '''
 *         Computes sensitivity measures (not normalised) for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyross.inference.SIR_type.sensitivity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sensitivity_individual);
  __Pyx_XDECREF(__pyx_v_sensitivity_correlated);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1334
 *         return sensitivity_individual, sensitivity_correlated
 * 
 *     def sample_gaussian(self, N, map_estimate, cov, x, Tf, contactMatrix, prior_dict, tangent=False):             # <<<<<<<<<<<<<<
 *         """
 *         Sample `N` samples of the parameters from the Gaussian centered at the MAP estimate with specified
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_47sample_gaussian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_46sample_gaussian[] = "\n        Sample `N` samples of the parameters from the Gaussian centered at the MAP estimate with specified\n        covariance `cov`.\n\n        Parameters\n        ----------\n        N: int\n            The number of samples.\n        map_estimate: dict\n            The MAP estimate, e.g. as computed by `inference.infer_parameters`.\n        cov: np.array\n            The covariance matrix of the flat parameters.\n        x:  np.array\n            The full trajectory.\n        Tf: float\n            The total time of the trajectory.\n        contactMatrix: callable\n            A function that returns the contact matrix at time t (input).\n        prior_dict: dict\n            A dictionary containing priors. See examples.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n\n        Returns\n        -------\n        samples: list of dict\n            N samples of the Gaussian distribution.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_47sample_gaussian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_map_estimate = 0;
  PyObject *__pyx_v_cov = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  CYTHON_UNUSED PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_prior_dict = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sample_gaussian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_map_estimate,&__pyx_n_s_cov_2,&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_prior_dict,&__pyx_n_s_tangent,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[7] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_map_estimate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, 1); __PYX_ERR(0, 1334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cov_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, 2); __PYX_ERR(0, 1334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, 3); __PYX_ERR(0, 1334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, 4); __PYX_ERR(0, 1334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, 5); __PYX_ERR(0, 1334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, 6); __PYX_ERR(0, 1334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sample_gaussian") < 0)) __PYX_ERR(0, 1334, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
    __pyx_v_map_estimate = values[1];
    __pyx_v_cov = values[2];
    __pyx_v_x = values[3];
    __pyx_v_Tf = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_prior_dict = values[6];
    __pyx_v_tangent = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sample_gaussian", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1334, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_gaussian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_46sample_gaussian(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_N, __pyx_v_map_estimate, __pyx_v_cov, __pyx_v_x, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_prior_dict, __pyx_v_tangent);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_46sample_gaussian(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_map_estimate, PyObject *__pyx_v_cov, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_prior_dict, PyObject *__pyx_v_tangent) {
  PyObject *__pyx_v_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_flat_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_guesses = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_loglike_args = NULL;
  PyObject *__pyx_v_mean = NULL;
  PyObject *__pyx_v_sample_parameters = NULL;
  PyObject *__pyx_v_samples = NULL;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_v_new_sample = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("sample_gaussian", 0);

  /* "pyross/inference.pyx":1364
 *         """
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 *         prior = Prior(prior_names, bounds, guess, stds)
 *         loglike_args = {'keys':keys, 'is_scale_parameter':is_scale_parameter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_v_prior_dict);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_prior_dict);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_check_length, __pyx_t_4) < 0) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1363, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_1,&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1363, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_1,&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
    __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 8) < 0) __PYX_ERR(0, 1363, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1363, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "pyross/inference.pyx":1363
 *             N samples of the Gaussian distribution.
 *         """
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)
 */
  __pyx_v_prior_names = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_keys = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_stds = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_bounds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_flat_guess_range = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_scaled_guesses = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1365
 *         prior_names, keys, guess, stds, bounds, flat_guess_range, is_scale_parameter, scaled_guesses \
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 *         loglike_args = {'keys':keys, 'is_scale_parameter':is_scale_parameter,
 *                        'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Prior); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1365, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_prior_names, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1365, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_prior_names);
    __Pyx_GIVEREF(__pyx_v_prior_names);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_12, __pyx_v_prior_names);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_12, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_12, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_12, __pyx_v_stds);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_prior = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1366
 *             = pyross.utils.parse_param_prior_dict(prior_dict, self.M, check_length=(not self.param_mapping_enabled))
 *         prior = Prior(prior_names, bounds, guess, stds)
 *         loglike_args = {'keys':keys, 'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                        'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,
 *                        'x':x, 'Tf':Tf, 'tangent':tangent}
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)

  /* "pyross/inference.pyx":1367
 *         prior = Prior(prior_names, bounds, guess, stds)
 *         loglike_args = {'keys':keys, 'is_scale_parameter':is_scale_parameter,
 *                        'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,             # <<<<<<<<<<<<<<
 *                        'x':x, 'Tf':Tf, 'tangent':tangent}
 * 
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_scaled_guesses, __pyx_v_scaled_guesses) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_flat_guess_range, __pyx_v_flat_guess_range) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)

  /* "pyross/inference.pyx":1368
 *         loglike_args = {'keys':keys, 'is_scale_parameter':is_scale_parameter,
 *                        'scaled_guesses':scaled_guesses, 'flat_guess_range':flat_guess_range,
 *                        'x':x, 'Tf':Tf, 'tangent':tangent}             # <<<<<<<<<<<<<<
 * 
 *         # Sample the flat parameters.
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_x, __pyx_v_x) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  __pyx_v_loglike_args = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1371
 * 
 *         # Sample the flat parameters.
 *         mean = map_estimate['flat_map']             # <<<<<<<<<<<<<<
 *         sample_parameters = np.random.multivariate_normal(mean, cov, N)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_flat_map); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_mean = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1372
 *         # Sample the flat parameters.
 *         mean = map_estimate['flat_map']
 *         sample_parameters = np.random.multivariate_normal(mean, cov, N)             # <<<<<<<<<<<<<<
 * 
 *         samples = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_random); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_mean, __pyx_v_cov, __pyx_v_N};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1372, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_mean, __pyx_v_cov, __pyx_v_N};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1372, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_12, __pyx_v_mean);
    __Pyx_INCREF(__pyx_v_cov);
    __Pyx_GIVEREF(__pyx_v_cov);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_12, __pyx_v_cov);
    __Pyx_INCREF(__pyx_v_N);
    __Pyx_GIVEREF(__pyx_v_N);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_12, __pyx_v_N);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_sample_parameters = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1374
 *         sample_parameters = np.random.multivariate_normal(mean, cov, N)
 * 
 *         samples = []             # <<<<<<<<<<<<<<
 *         for sample in sample_parameters:
 *             new_sample = map_estimate.copy()
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_samples = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1375
 * 
 *         samples = []
 *         for sample in sample_parameters:             # <<<<<<<<<<<<<<
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample
 */
  if (likely(PyList_CheckExact(__pyx_v_sample_parameters)) || PyTuple_CheckExact(__pyx_v_sample_parameters)) {
    __pyx_t_4 = __pyx_v_sample_parameters; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_sample_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1375, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1375, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1375, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1375, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1375, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      }
    } else {
      __pyx_t_9 = __pyx_t_14(__pyx_t_4);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1375, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":1376
 *         samples = []
 *         for sample in sample_parameters:
 *             new_sample = map_estimate.copy()             # <<<<<<<<<<<<<<
 *             new_sample['flat_params'] = sample
 *             new_sample['map_dict'] = \
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_map_estimate, __pyx_n_s_copy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_sample, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":1377
 *         for sample in sample_parameters:
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample             # <<<<<<<<<<<<<<
 *             new_sample['map_dict'] = \
 *                 pyross.utils.unflatten_parameters(sample, map_estimate['flat_guess_range'],
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_flat_params, __pyx_v_sample) < 0)) __PYX_ERR(0, 1377, __pyx_L1_error)

    /* "pyross/inference.pyx":1379
 *             new_sample['flat_params'] = sample
 *             new_sample['map_dict'] = \
 *                 pyross.utils.unflatten_parameters(sample, map_estimate['flat_guess_range'],             # <<<<<<<<<<<<<<
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_guesses'])
 *             l_like = self._loglike(sample, **loglike_args)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyross); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_flat_guess_range); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "pyross/inference.pyx":1380
 *             new_sample['map_dict'] = \
 *                 pyross.utils.unflatten_parameters(sample, map_estimate['flat_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_guesses'])             # <<<<<<<<<<<<<<
 *             l_like = self._loglike(sample, **loglike_args)
 *             l_prior = np.sum(prior.logpdf(sample))
 */
    __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_is_scale_parameter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_scaled_guesses); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_sample, __pyx_t_7, __pyx_t_6, __pyx_t_5};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_sample, __pyx_t_7, __pyx_t_6, __pyx_t_5};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_sample);
      __Pyx_GIVEREF(__pyx_v_sample);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_12, __pyx_v_sample);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_12, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_12, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_12, __pyx_t_5);
      __pyx_t_7 = 0;
      __pyx_t_6 = 0;
      __pyx_t_5 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "pyross/inference.pyx":1378
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample
 *             new_sample['map_dict'] = \             # <<<<<<<<<<<<<<
 *                 pyross.utils.unflatten_parameters(sample, map_estimate['flat_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_guesses'])
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_map_dict, __pyx_t_9) < 0)) __PYX_ERR(0, 1378, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyross/inference.pyx":1381
 *                 pyross.utils.unflatten_parameters(sample, map_estimate['flat_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_guesses'])
 *             l_like = self._loglike(sample, **loglike_args)             # <<<<<<<<<<<<<<
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglike); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_sample);
    __Pyx_GIVEREF(__pyx_v_sample);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_sample);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, __pyx_v_loglike_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_like, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1382
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_guesses'])
 *             l_like = self._loglike(sample, **loglike_args)
 *             l_prior = np.sum(prior.logpdf(sample))             # <<<<<<<<<<<<<<
 *             l_post = l_like + l_prior
 *             new_sample['log_posterior'] = l_post
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_sample) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_sample);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_prior, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1383
 *             l_like = self._loglike(sample, **loglike_args)
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior             # <<<<<<<<<<<<<<
 *             new_sample['log_posterior'] = l_post
 *             new_sample['log_prior'] = l_prior
 */
    __pyx_t_3 = PyNumber_Add(__pyx_v_l_like, __pyx_v_l_prior); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1384
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior
 *             new_sample['log_posterior'] = l_post             # <<<<<<<<<<<<<<
 *             new_sample['log_prior'] = l_prior
 *             new_sample['log_likelihood'] = l_like
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0)) __PYX_ERR(0, 1384, __pyx_L1_error)

    /* "pyross/inference.pyx":1385
 *             l_post = l_like + l_prior
 *             new_sample['log_posterior'] = l_post
 *             new_sample['log_prior'] = l_prior             # <<<<<<<<<<<<<<
 *             new_sample['log_likelihood'] = l_like
 *             samples.append(new_sample)
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0)) __PYX_ERR(0, 1385, __pyx_L1_error)

    /* "pyross/inference.pyx":1386
 *             new_sample['log_posterior'] = l_post
 *             new_sample['log_prior'] = l_prior
 *             new_sample['log_likelihood'] = l_like             # <<<<<<<<<<<<<<
 *             samples.append(new_sample)
 * 
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0)) __PYX_ERR(0, 1386, __pyx_L1_error)

    /* "pyross/inference.pyx":1387
 *             new_sample['log_prior'] = l_prior
 *             new_sample['log_likelihood'] = l_like
 *             samples.append(new_sample)             # <<<<<<<<<<<<<<
 * 
 *         return samples
 */
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_samples, __pyx_v_new_sample); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1387, __pyx_L1_error)

    /* "pyross/inference.pyx":1375
 * 
 *         samples = []
 *         for sample in sample_parameters:             # <<<<<<<<<<<<<<
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1389
 *             samples.append(new_sample)
 * 
 *         return samples             # <<<<<<<<<<<<<<
 * 
 *     def evidence_laplace(self, x, Tf, infer_result, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_samples);
  __pyx_r = __pyx_v_samples;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1334
 *         return sensitivity_individual, sensitivity_correlated
 * 
 *     def sample_gaussian(self, N, map_estimate, cov, x, Tf, contactMatrix, prior_dict, tangent=False):             # <<<<<<<<<<<<<<
 *         """
 *         Sample `N` samples of the parameters from the Gaussian centered at the MAP estimate with specified
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_gaussian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_flat_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_guesses);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_loglike_args);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_sample_parameters);
  __Pyx_XDECREF(__pyx_v_samples);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XDECREF(__pyx_v_new_sample);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1391
 *         return samples
 * 
 *     def evidence_laplace(self, x, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                          generator=None,
 *                 intervention_fun=None, tangent=False, eps=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_49evidence_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_48evidence_laplace[] = "\n        Compute the evidence using a Laplace approximation at the MAP estimate.\n\n        Parameters\n        ----------\n        x: 2d numpy.array\n            Observed trajectory (number of data points x (age groups * model classes))\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        eps: float or numpy.array, optional\n            Step size for finite differences computation of the hessian with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result['flat_params'])`. If not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_posterior']),infer_result['log_posterior'])**(0.25)` is used. For `fd_method=\"central\"` it is recommended to use a step-size ""greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        fd_method: str, optional\n            The type of finite-difference scheme used to compute the hessian, supports \"forward\" and \"central\". Default is \"central\".\n        inter_steps: int, optional\n            Only used if `tangent=False`. Intermediate steps for interpolation between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 10.\n        Returns\n        -------\n        log_evidence: float\n            The log-evidence computed via Laplace approximation at the MAP estimate.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_49evidence_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_fd_method = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evidence_laplace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_eps,&__pyx_n_s_fd_method,&__pyx_n_s_inter_steps,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1392
 * 
 *     def evidence_laplace(self, x, Tf, infer_result, contactMatrix=None,
 *                          generator=None,             # <<<<<<<<<<<<<<
 *                 intervention_fun=None, tangent=False, eps=None,
 *                 fd_method="central", inter_steps=10):
 */
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1393
 *     def evidence_laplace(self, x, Tf, infer_result, contactMatrix=None,
 *                          generator=None,
 *                 intervention_fun=None, tangent=False, eps=None,             # <<<<<<<<<<<<<<
 *                 fd_method="central", inter_steps=10):
 *         '''
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_False);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)__pyx_n_u_central);
    values[9] = ((PyObject *)__pyx_int_10);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evidence_laplace", 0, 3, 10, 1); __PYX_ERR(0, 1391, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evidence_laplace", 0, 3, 10, 2); __PYX_ERR(0, 1391, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fd_method);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evidence_laplace") < 0)) __PYX_ERR(0, 1391, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_Tf = values[1];
    __pyx_v_infer_result = values[2];
    __pyx_v_contactMatrix = values[3];
    __pyx_v_generator = values[4];
    __pyx_v_intervention_fun = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_eps = values[7];
    __pyx_v_fd_method = values[8];
    __pyx_v_inter_steps = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evidence_laplace", 0, 3, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1391, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.evidence_laplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_48evidence_laplace(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":1391
 *         return samples
 * 
 *     def evidence_laplace(self, x, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                          generator=None,
 *                 intervention_fun=None, tangent=False, eps=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_48evidence_laplace(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps) {
  PyObject *__pyx_v_logP_MAPs = NULL;
  PyObject *__pyx_v_A = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("evidence_laplace", 0);

  /* "pyross/inference.pyx":1433
 *             The log-evidence computed via Laplace approximation at the MAP estimate.
 *         '''
 *         logP_MAPs = infer_result['log_posterior']             # <<<<<<<<<<<<<<
 *         A = self.hessian(x, Tf, infer_result, contactMatrix, generator,
 *                          intervention_fun, tangent, eps,
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_log_posterior); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_logP_MAPs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1434
 *         '''
 *         logP_MAPs = infer_result['log_posterior']
 *         A = self.hessian(x, Tf, infer_result, contactMatrix, generator,             # <<<<<<<<<<<<<<
 *                          intervention_fun, tangent, eps,
 *                          fd_method, inter_steps)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_hessian); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pyross/inference.pyx":1436
 *         A = self.hessian(x, Tf, infer_result, contactMatrix, generator,
 *                          intervention_fun, tangent, eps,
 *                          fd_method, inter_steps)             # <<<<<<<<<<<<<<
 *         k = A.shape[0]
 * 
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_x, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_x, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_Tf);
    __Pyx_GIVEREF(__pyx_v_Tf);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_Tf);
    __Pyx_INCREF(__pyx_v_infer_result);
    __Pyx_GIVEREF(__pyx_v_infer_result);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_infer_result);
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_intervention_fun);
    __Pyx_INCREF(__pyx_v_tangent);
    __Pyx_GIVEREF(__pyx_v_tangent);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_tangent);
    __Pyx_INCREF(__pyx_v_eps);
    __Pyx_GIVEREF(__pyx_v_eps);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_eps);
    __Pyx_INCREF(__pyx_v_fd_method);
    __Pyx_GIVEREF(__pyx_v_fd_method);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_fd_method);
    __Pyx_INCREF(__pyx_v_inter_steps);
    __Pyx_GIVEREF(__pyx_v_inter_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_inter_steps);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_A = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1437
 *                          intervention_fun, tangent, eps,
 *                          fd_method, inter_steps)
 *         k = A.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return logP_MAPs - 0.5*np.log(np.linalg.det(A)) + 0.5*k*np.log(2*np.pi)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_k = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":1439
 *         k = A.shape[0]
 * 
 *         return logP_MAPs - 0.5*np.log(np.linalg.det(A)) + 0.5*k*np.log(2*np.pi)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linalg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_det); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_logP_MAPs, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1391
 *         return samples
 * 
 *     def evidence_laplace(self, x, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                          generator=None,
 *                 intervention_fun=None, tangent=False, eps=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SIR_type.evidence_laplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logP_MAPs);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1442
 * 
 * 
 *     def obtain_minus_log_p(self, parameters, np.ndarray x, double Tf, contactMatrix, tangent=False):             # <<<<<<<<<<<<<<
 *         '''Computes -logp of a full trajectory
 *         Parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_51obtain_minus_log_p(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_50obtain_minus_log_p[] = "Computes -logp of a full trajectory\n        Parameters\n        ----------\n        parameters: dict\n            A dictionary for the model parameters.\n        x: np.array\n            The full trajectory.\n        Tf: float\n            The time duration of the trajectory.\n        contactMatrix: callable\n            A function that takes time (t) as an argument and returns the contactMatrix\n        tangent: bool, optional\n            Set to True to use tangent space inference.\n\n        Returns\n        -------\n        minus_logp: float\n            Value of -logp\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_51obtain_minus_log_p(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyArrayObject *__pyx_v_x = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("obtain_minus_log_p (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_x,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_tangent,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_minus_log_p", 0, 4, 5, 1); __PYX_ERR(0, 1442, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_minus_log_p", 0, 4, 5, 2); __PYX_ERR(0, 1442, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_minus_log_p", 0, 4, 5, 3); __PYX_ERR(0, 1442, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "obtain_minus_log_p") < 0)) __PYX_ERR(0, 1442, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parameters = values[0];
    __pyx_v_x = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1442, __pyx_L3_error)
    __pyx_v_contactMatrix = values[3];
    __pyx_v_tangent = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("obtain_minus_log_p", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1442, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_minus_log_p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 1442, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_50obtain_minus_log_p(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_parameters, __pyx_v_x, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_tangent);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_50obtain_minus_log_p(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters, PyArrayObject *__pyx_v_x, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_tangent) {
  __Pyx_memviewslice __pyx_v_x_memview = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_minus_logp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("obtain_minus_log_p", 0);

  /* "pyross/inference.pyx":1465
 *         cdef:
 *             double minus_log_p
 *             double [:, :] x_memview=x.astype('float')             # <<<<<<<<<<<<<<
 *         self.set_params(parameters)
 *         self.contactMatrix = contactMatrix
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_u_float) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_float);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_x_memview = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":1466
 *             double minus_log_p
 *             double [:, :] x_memview=x.astype('float')
 *         self.set_params(parameters)             # <<<<<<<<<<<<<<
 *         self.contactMatrix = contactMatrix
 *         if tangent:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1467
 *             double [:, :] x_memview=x.astype('float')
 *         self.set_params(parameters)
 *         self.contactMatrix = contactMatrix             # <<<<<<<<<<<<<<
 *         if tangent:
 *             minus_logp = self._obtain_logp_for_traj_tangent(x_memview, Tf)
 */
  __Pyx_INCREF(__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_v_contactMatrix);
  __Pyx_GOTREF(__pyx_v_self->contactMatrix);
  __Pyx_DECREF(__pyx_v_self->contactMatrix);
  __pyx_v_self->contactMatrix = __pyx_v_contactMatrix;

  /* "pyross/inference.pyx":1468
 *         self.set_params(parameters)
 *         self.contactMatrix = contactMatrix
 *         if tangent:             # <<<<<<<<<<<<<<
 *             minus_logp = self._obtain_logp_for_traj_tangent(x_memview, Tf)
 *         else:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1468, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "pyross/inference.pyx":1469
 *         self.contactMatrix = contactMatrix
 *         if tangent:
 *             minus_logp = self._obtain_logp_for_traj_tangent(x_memview, Tf)             # <<<<<<<<<<<<<<
 *         else:
 *             minus_logp = self._obtain_logp_for_traj(x_memview, Tf)
 */
    __pyx_v_minus_logp = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_obtain_logp_for_traj_tangent(__pyx_v_self, __pyx_v_x_memview, __pyx_v_Tf);

    /* "pyross/inference.pyx":1468
 *         self.set_params(parameters)
 *         self.contactMatrix = contactMatrix
 *         if tangent:             # <<<<<<<<<<<<<<
 *             minus_logp = self._obtain_logp_for_traj_tangent(x_memview, Tf)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":1471
 *             minus_logp = self._obtain_logp_for_traj_tangent(x_memview, Tf)
 *         else:
 *             minus_logp = self._obtain_logp_for_traj(x_memview, Tf)             # <<<<<<<<<<<<<<
 *         return minus_logp
 * 
 */
  /*else*/ {
    __pyx_v_minus_logp = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_obtain_logp_for_traj(__pyx_v_self, __pyx_v_x_memview, __pyx_v_Tf, NULL);
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":1472
 *         else:
 *             minus_logp = self._obtain_logp_for_traj(x_memview, Tf)
 *         return minus_logp             # <<<<<<<<<<<<<<
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_minus_logp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1442
 * 
 * 
 *     def obtain_minus_log_p(self, parameters, np.ndarray x, double Tf, contactMatrix, tangent=False):             # <<<<<<<<<<<<<<
 *         '''Computes -logp of a full trajectory
 *         Parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_minus_log_p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_x_memview, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1474
 *         return minus_logp
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         # this function will be overridden in case of extra (non-additive) compartments
 *         cdef:
 */

static PyArrayObject *__pyx_f_6pyross_9inference_8SIR_type__get_r_from_x(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_x) {
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_get_r_from_x", 0);

  /* "pyross/inference.pyx":1478
 *         cdef:
 *             np.ndarray r
 *         r = self.fi - np.sum(x.reshape((int(self.dim/self.M), self.M)), axis=0)             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->dim / __pyx_v_self->M)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1478, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_self->fi), __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1478, __pyx_L1_error)
  __pyx_v_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1479
 *             np.ndarray r
 *         r = self.fi - np.sum(x.reshape((int(self.dim/self.M), self.M)), axis=0)
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_r));
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1474
 *         return minus_logp
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         # this function will be overridden in case of extra (non-additive) compartments
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyross.inference.SIR_type._get_r_from_x", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1481
 *         return r
 * 
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double eps=0.1/self.Omega, dev
 */

static double __pyx_f_6pyross_9inference_8SIR_type__penalty_from_negative_values(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_x0) {
  double __pyx_v_eps;
  double __pyx_v_dev;
  PyArrayObject *__pyx_v_R_init = 0;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("_penalty_from_negative_values", 0);

  /* "pyross/inference.pyx":1483
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):
 *         cdef:
 *             double eps=0.1/self.Omega, dev             # <<<<<<<<<<<<<<
 *             np.ndarray R_init
 *         R_init = self._get_r_from_x(x0)
 */
  __pyx_v_eps = (0.1 / __pyx_v_self->Omega);

  /* "pyross/inference.pyx":1485
 *             double eps=0.1/self.Omega, dev
 *             np.ndarray R_init
 *         R_init = self._get_r_from_x(x0)             # <<<<<<<<<<<<<<
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(x0[x0<0]))
 *         return (dev/eps)**2 + (dev/eps)**8
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_get_r_from_x(__pyx_v_self, __pyx_v_x0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_R_init = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1486
 *             np.ndarray R_init
 *         R_init = self._get_r_from_x(x0)
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(x0[x0<0]))             # <<<<<<<<<<<<<<
 *         return (dev/eps)**2 + (dev/eps)**8
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_R_init), __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_R_init), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_x0), __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x0), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_dev = __pyx_t_6;

  /* "pyross/inference.pyx":1487
 *         R_init = self._get_r_from_x(x0)
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(x0[x0<0]))
 *         return (dev/eps)**2 + (dev/eps)**8             # <<<<<<<<<<<<<<
 * 
 *     def _all_positive(self, np.ndarray x0):
 */
  __pyx_r = (pow((__pyx_v_dev / __pyx_v_eps), 2.0) + pow((__pyx_v_dev / __pyx_v_eps), 8.0));
  goto __pyx_L0;

  /* "pyross/inference.pyx":1481
 *         return r
 * 
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double eps=0.1/self.Omega, dev
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("pyross.inference.SIR_type._penalty_from_negative_values", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_R_init);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1489
 *         return (dev/eps)**2 + (dev/eps)**8
 * 
 *     def _all_positive(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         r = self._get_r_from_x(x0)
 *         return (x0>0).all() and (r>0).all()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_53_all_positive(PyObject *__pyx_v_self, PyObject *__pyx_v_x0); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_53_all_positive(PyObject *__pyx_v_self, PyObject *__pyx_v_x0) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_all_positive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x0), __pyx_ptype_5numpy_ndarray, 1, "x0", 0))) __PYX_ERR(0, 1489, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_52_all_positive(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyArrayObject *)__pyx_v_x0));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_52_all_positive(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_x0) {
  PyArrayObject *__pyx_v_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_all_positive", 0);

  /* "pyross/inference.pyx":1490
 * 
 *     def _all_positive(self, np.ndarray x0):
 *         r = self._get_r_from_x(x0)             # <<<<<<<<<<<<<<
 *         return (x0>0).all() and (r>0).all()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_get_r_from_x(__pyx_v_self, __pyx_v_x0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1491
 *     def _all_positive(self, np.ndarray x0):
 *         r = self._get_r_from_x(x0)
 *         return (x0>0).all() and (r>0).all()             # <<<<<<<<<<<<<<
 * 
 *     def latent_infer_parameters(self, np.ndarray obs, np.ndarray fltr, double Tf,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_x0), __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1491, __pyx_L1_error)
  if (__pyx_t_5) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_r), __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1489
 *         return (dev/eps)**2 + (dev/eps)**8
 * 
 *     def _all_positive(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         r = self._get_r_from_x(x0)
 *         return (x0>0).all() and (r>0).all()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type._all_positive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1493
 *         return (x0>0).all() and (r>0).all()
 * 
 *     def latent_infer_parameters(self, np.ndarray obs, np.ndarray fltr, double Tf,             # <<<<<<<<<<<<<<
 *                             contactMatrix, param_priors, init_priors, **kwargs):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_55latent_infer_parameters(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_54latent_infer_parameters[] = "\n        Compute the maximum a-posteriori (MAP) estimate of the parameters and the initial conditions of a SIR type model\n        when the classes are only partially observed. Unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n            see `latent_infer`\n\n        Returns\n        -------\n        output: dict\n            Contains the following keys for users:\n\n            map_params_dict: dict\n                A dictionary for the MAP estimates for parameter values.\n                The keys are the names of the parameters.\n            map_x0: np.array\n                The MAP estimate for the initial conditions.\n            -logp: float\n                The value of -logp at MAP.\n\n        Note\n        ----\n        This function just calls latent_infer (with fixed `contactMatrix`), will be deprecated.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_55latent_infer_parameters(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer_parameters (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_parameters", 1, 6, 6, 1); __PYX_ERR(0, 1493, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_parameters", 1, 6, 6, 2); __PYX_ERR(0, 1493, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_parameters", 1, 6, 6, 3); __PYX_ERR(0, 1493, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_parameters", 1, 6, 6, 4); __PYX_ERR(0, 1493, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_parameters", 1, 6, 6, 5); __PYX_ERR(0, 1493, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "latent_infer_parameters") < 0)) __PYX_ERR(0, 1493, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_obs = ((PyArrayObject *)values[0]);
    __pyx_v_fltr = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1493, __pyx_L3_error)
    __pyx_v_contactMatrix = values[3];
    __pyx_v_param_priors = values[4];
    __pyx_v_init_priors = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer_parameters", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1493, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 1493, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 1493, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_54latent_infer_parameters(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_kwargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_54latent_infer_parameters(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("latent_infer_parameters", 0);

  /* "pyross/inference.pyx":1521
 *         """
 * 
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                             intervention_fun=None, **kwargs)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_obs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_obs));
  __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_fltr));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_param_priors);
  __Pyx_INCREF(__pyx_v_init_priors);
  __Pyx_GIVEREF(__pyx_v_init_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_init_priors);
  __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_v_contactMatrix) < 0) __PYX_ERR(0, 1521, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 1521, __pyx_L1_error)

  /* "pyross/inference.pyx":1522
 * 
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix, generator=None,
 *                             intervention_fun=None, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         # rename for backwards compatibility
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 1521, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (__Pyx_MergeKeywords(__pyx_t_2, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1522, __pyx_L1_error)

  /* "pyross/inference.pyx":1521
 *         """
 * 
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix, generator=None,             # <<<<<<<<<<<<<<
 *                             intervention_fun=None, **kwargs)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_output_dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1525
 * 
 *         # rename for backwards compatibility
 *         output_dict['map_x0'] = output_dict['x0']             # <<<<<<<<<<<<<<
 *         output_dict['flat_map'] = output_dict['flat_params']
 *         output_dict['map_params_dict'] = output_dict['params_dict']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_x0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_map_x0, __pyx_t_4) < 0)) __PYX_ERR(0, 1525, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1526
 *         # rename for backwards compatibility
 *         output_dict['map_x0'] = output_dict['x0']
 *         output_dict['flat_map'] = output_dict['flat_params']             # <<<<<<<<<<<<<<
 *         output_dict['map_params_dict'] = output_dict['params_dict']
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_flat_map, __pyx_t_4) < 0)) __PYX_ERR(0, 1526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1527
 *         output_dict['map_x0'] = output_dict['x0']
 *         output_dict['flat_map'] = output_dict['flat_params']
 *         output_dict['map_params_dict'] = output_dict['params_dict']             # <<<<<<<<<<<<<<
 * 
 *         return output_dict
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_params_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_map_params_dict, __pyx_t_4) < 0)) __PYX_ERR(0, 1527, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1529
 *         output_dict['map_params_dict'] = output_dict['params_dict']
 * 
 *         return output_dict             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_dict);
  __pyx_r = __pyx_v_output_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1493
 *         return (x0>0).all() and (r>0).all()
 * 
 *     def latent_infer_parameters(self, np.ndarray obs, np.ndarray fltr, double Tf,             # <<<<<<<<<<<<<<
 *                             contactMatrix, param_priors, init_priors, **kwargs):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1532
 * 
 * 
 *     def nested_sampling_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,             # <<<<<<<<<<<<<<
 *                                          init_priors,tangent=False, verbose=False, nprocesses=0, queue_size=None,
 *                                          maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_57nested_sampling_latent_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_56nested_sampling_latent_inference[] = "\n        Compute the log-evidence and weighted samples of the a-posteriori distribution of the parameters of a SIR type model\n        with latent variables using nested sampling as implemented in the `dynesty` Python package.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.latent_infer_nested_sampling` and will be deleted\n        in a future version of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_57nested_sampling_latent_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_v_queue_size = 0;
  PyObject *__pyx_v_maxiter = 0;
  PyObject *__pyx_v_maxcall = 0;
  PyObject *__pyx_v_dlogz = 0;
  PyObject *__pyx_v_n_effective = 0;
  PyObject *__pyx_v_add_live = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_dynesty_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nested_sampling_latent_inference (wrapper)", 0);
  __pyx_v_dynesty_args = PyDict_New(); if (unlikely(!__pyx_v_dynesty_args)) return NULL;
  __Pyx_GOTREF(__pyx_v_dynesty_args);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_nprocesses,&__pyx_n_s_queue_size,&__pyx_n_s_maxiter,&__pyx_n_s_maxcall,&__pyx_n_s_dlogz,&__pyx_n_s_n_effective,&__pyx_n_s_add_live,&__pyx_n_s_sampler,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":1533
 * 
 *     def nested_sampling_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,
 *                                          init_priors,tangent=False, verbose=False, nprocesses=0, queue_size=None,             # <<<<<<<<<<<<<<
 *                                          maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 *                                          sampler=None, **dynesty_args):
 */
    values[6] = ((PyObject *)Py_False);
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)__pyx_int_0);
    values[9] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1534
 *     def nested_sampling_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,
 *                                          init_priors,tangent=False, verbose=False, nprocesses=0, queue_size=None,
 *                                          maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,             # <<<<<<<<<<<<<<
 *                                          sampler=None, **dynesty_args):
 *         """
 */
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);
    values[13] = ((PyObject *)Py_None);
    values[14] = ((PyObject *)Py_True);

    /* "pyross/inference.pyx":1535
 *                                          init_priors,tangent=False, verbose=False, nprocesses=0, queue_size=None,
 *                                          maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 *                                          sampler=None, **dynesty_args):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the log-evidence and weighted samples of the a-posteriori distribution of the parameters of a SIR type model
 */
    values[15] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference", 0, 6, 16, 1); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference", 0, 6, 16, 2); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference", 0, 6, 16, 3); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference", 0, 6, 16, 4); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference", 0, 6, 16, 5); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_size);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxiter);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxcall);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dlogz);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_effective);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_add_live);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[15] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_dynesty_args, values, pos_args, "nested_sampling_latent_inference") < 0)) __PYX_ERR(0, 1532, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = ((PyArrayObject *)values[0]);
    __pyx_v_fltr = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1532, __pyx_L3_error)
    __pyx_v_contactMatrix = values[3];
    __pyx_v_param_priors = values[4];
    __pyx_v_init_priors = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_verbose = values[7];
    __pyx_v_nprocesses = values[8];
    __pyx_v_queue_size = values[9];
    __pyx_v_maxiter = values[10];
    __pyx_v_maxcall = values[11];
    __pyx_v_dlogz = values[12];
    __pyx_v_n_effective = values[13];
    __pyx_v_add_live = values[14];
    __pyx_v_sampler = values[15];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference", 0, 6, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1532, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_dynesty_args); __pyx_v_dynesty_args = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_latent_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 1532, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 1532, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_56nested_sampling_latent_inference(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_nprocesses, __pyx_v_queue_size, __pyx_v_maxiter, __pyx_v_maxcall, __pyx_v_dlogz, __pyx_v_n_effective, __pyx_v_add_live, __pyx_v_sampler, __pyx_v_dynesty_args);

  /* "pyross/inference.pyx":1532
 * 
 * 
 *     def nested_sampling_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,             # <<<<<<<<<<<<<<
 *                                          init_priors,tangent=False, verbose=False, nprocesses=0, queue_size=None,
 *                                          maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dynesty_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_56nested_sampling_latent_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("nested_sampling_latent_inference", 0);

  /* "pyross/inference.pyx":1545
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         return self.latent_infer_nested_sampling(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                                  generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                                  nprocesses=nprocesses, queue_size=queue_size, maxiter=maxiter, maxcall=maxcall,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer_nested_sampling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_obs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_obs));
  __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_fltr));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_param_priors);
  __Pyx_INCREF(__pyx_v_init_priors);
  __Pyx_GIVEREF(__pyx_v_init_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_init_priors);
  __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_v_contactMatrix) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)

  /* "pyross/inference.pyx":1546
 *         """
 *         return self.latent_infer_nested_sampling(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,
 *                                                  generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,             # <<<<<<<<<<<<<<
 *                                                  nprocesses=nprocesses, queue_size=queue_size, maxiter=maxiter, maxcall=maxcall,
 *                                                  dlogz=dlogz, n_effective=n_effective, add_live=add_live, sampler=sampler,
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_verbose, __pyx_v_verbose) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)

  /* "pyross/inference.pyx":1547
 *         return self.latent_infer_nested_sampling(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,
 *                                                  generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                                  nprocesses=nprocesses, queue_size=queue_size, maxiter=maxiter, maxcall=maxcall,             # <<<<<<<<<<<<<<
 *                                                  dlogz=dlogz, n_effective=n_effective, add_live=add_live, sampler=sampler,
 *                                                  **dynesty_args )
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_nprocesses, __pyx_v_nprocesses) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_queue_size, __pyx_v_queue_size) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxiter, __pyx_v_maxiter) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxcall, __pyx_v_maxcall) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)

  /* "pyross/inference.pyx":1548
 *                                                  generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                                  nprocesses=nprocesses, queue_size=queue_size, maxiter=maxiter, maxcall=maxcall,
 *                                                  dlogz=dlogz, n_effective=n_effective, add_live=add_live, sampler=sampler,             # <<<<<<<<<<<<<<
 *                                                  **dynesty_args )
 * 
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dlogz, __pyx_v_dlogz) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_effective, __pyx_v_n_effective) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_add_live, __pyx_v_add_live) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sampler, __pyx_v_sampler) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1549
 *                                                  nprocesses=nprocesses, queue_size=queue_size, maxiter=maxiter, maxcall=maxcall,
 *                                                  dlogz=dlogz, n_effective=n_effective, add_live=add_live, sampler=sampler,
 *                                                  **dynesty_args )             # <<<<<<<<<<<<<<
 * 
 *     def nested_sampling_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors):
 */
  if (__Pyx_MergeKeywords(__pyx_t_2, __pyx_v_dynesty_args) < 0) __PYX_ERR(0, 1549, __pyx_L1_error)

  /* "pyross/inference.pyx":1545
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         return self.latent_infer_nested_sampling(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                                  generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                                  nprocesses=nprocesses, queue_size=queue_size, maxiter=maxiter, maxcall=maxcall,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1532
 * 
 * 
 *     def nested_sampling_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,             # <<<<<<<<<<<<<<
 *                                          init_priors,tangent=False, verbose=False, nprocesses=0, queue_size=None,
 *                                          maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_latent_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1551
 *                                                  **dynesty_args )
 * 
 *     def nested_sampling_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `nested_sampling_latent_inference` and produce output dictionaries for further use
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_59nested_sampling_latent_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_58nested_sampling_latent_inference_process_result[] = "\n        Take the sampler generated by `nested_sampling_latent_inference` and produce output dictionaries for further use\n        in the pyross framework.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.latent_infer_nested_sampling_process_result` and will be\n        deleted in a future version of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_59nested_sampling_latent_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nested_sampling_latent_inference_process_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference_process_result", 1, 5, 5, 1); __PYX_ERR(0, 1551, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference_process_result", 1, 5, 5, 2); __PYX_ERR(0, 1551, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference_process_result", 1, 5, 5, 3); __PYX_ERR(0, 1551, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference_process_result", 1, 5, 5, 4); __PYX_ERR(0, 1551, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nested_sampling_latent_inference_process_result") < 0)) __PYX_ERR(0, 1551, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_sampler = values[0];
    __pyx_v_obs = values[1];
    __pyx_v_fltr = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nested_sampling_latent_inference_process_result", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1551, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_latent_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_58nested_sampling_latent_inference_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_obs, __pyx_v_fltr, __pyx_v_param_priors, __pyx_v_init_priors);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_58nested_sampling_latent_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_output_samples = NULL;
  PyObject *__pyx_v_out_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_RefNannySetupContext("nested_sampling_latent_inference_process_result", 0);

  /* "pyross/inference.pyx":1561
 *         deleted in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         result, output_samples = self.latent_infer_nested_sampling_process_result(sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                                                                   contactMatrix=self.contactMatrix)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer_nested_sampling_pro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_sampler);
  __Pyx_GIVEREF(__pyx_v_sampler);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sampler);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_GIVEREF(__pyx_v_obs);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);
  __Pyx_GIVEREF(__pyx_v_fltr);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_fltr);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_param_priors);
  __Pyx_INCREF(__pyx_v_init_priors);
  __Pyx_GIVEREF(__pyx_v_init_priors);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_init_priors);

  /* "pyross/inference.pyx":1562
 *         """
 *         result, output_samples = self.latent_infer_nested_sampling_process_result(sampler, obs, fltr, param_priors, init_priors,
 *                                                                                   contactMatrix=self.contactMatrix)             # <<<<<<<<<<<<<<
 * 
 *         # Match old dictionary key names for backward compatibility.
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_contactMatrix, __pyx_v_self->contactMatrix) < 0) __PYX_ERR(0, 1562, __pyx_L1_error)

  /* "pyross/inference.pyx":1561
 *         deleted in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         result, output_samples = self.latent_infer_nested_sampling_process_result(sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                                                                   contactMatrix=self.contactMatrix)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1561, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_1), 2) < 0) __PYX_ERR(0, 1561, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1561, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_output_samples = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":1565
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         for out_dict in output_samples:             # <<<<<<<<<<<<<<
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 */
  if (likely(PyList_CheckExact(__pyx_v_output_samples)) || PyTuple_CheckExact(__pyx_v_output_samples)) {
    __pyx_t_4 = __pyx_v_output_samples; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_output_samples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1565, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1565, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1565, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1565, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1565, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1565, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_out_dict, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1566
 *         # Match old dictionary key names for backward compatibility.
 *         for out_dict in output_samples:
 *             out_dict['map_x0']          = out_dict.pop('x0')             # <<<<<<<<<<<<<<
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_x0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_x0);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_map_x0, __pyx_t_2) < 0)) __PYX_ERR(0, 1566, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1567
 *         for out_dict in output_samples:
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')             # <<<<<<<<<<<<<<
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_flat_params) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_flat_params);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_flat_map, __pyx_t_2) < 0)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1568
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')             # <<<<<<<<<<<<<<
 * 
 *         return result, output_samples
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_params_dict);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_map_params_dict, __pyx_t_2) < 0)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":1565
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         for out_dict in output_samples:             # <<<<<<<<<<<<<<
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1570
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')
 * 
 *         return result, output_samples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_result);
  __Pyx_GIVEREF(__pyx_v_result);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_result);
  __Pyx_INCREF(__pyx_v_output_samples);
  __Pyx_GIVEREF(__pyx_v_output_samples);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_output_samples);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1551
 *                                                  **dynesty_args )
 * 
 *     def nested_sampling_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `nested_sampling_latent_inference` and produce output dictionaries for further use
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.nested_sampling_latent_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_out_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1573
 * 
 * 
 *     def mcmc_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,             # <<<<<<<<<<<<<<
 *                               init_priors, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,
 *                               nsamples=1000, nprocesses=0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_61mcmc_latent_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_60mcmc_latent_inference[] = "\n        Sample the posterior distribution of the epidemiological parameters using ensemble MCMC.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.latent_infer_mcmc` and will be deleted\n        in a future version of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_61mcmc_latent_inference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_nwalkers = 0;
  PyObject *__pyx_v_walker_pos = 0;
  PyObject *__pyx_v_nsamples = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mcmc_latent_inference (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_sampler,&__pyx_n_s_nwalkers,&__pyx_n_s_walker_pos,&__pyx_n_s_nsamples,&__pyx_n_s_nprocesses,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":1574
 * 
 *     def mcmc_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,
 *                               init_priors, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,             # <<<<<<<<<<<<<<
 *                               nsamples=1000, nprocesses=0):
 *         """
 */
    values[6] = ((PyObject *)Py_False);
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)__pyx_int_1000);
    values[12] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference", 0, 6, 13, 1); __PYX_ERR(0, 1573, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference", 0, 6, 13, 2); __PYX_ERR(0, 1573, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference", 0, 6, 13, 3); __PYX_ERR(0, 1573, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference", 0, 6, 13, 4); __PYX_ERR(0, 1573, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference", 0, 6, 13, 5); __PYX_ERR(0, 1573, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nwalkers);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_walker_pos);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsamples);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mcmc_latent_inference") < 0)) __PYX_ERR(0, 1573, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = ((PyArrayObject *)values[0]);
    __pyx_v_fltr = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1573, __pyx_L3_error)
    __pyx_v_contactMatrix = values[3];
    __pyx_v_param_priors = values[4];
    __pyx_v_init_priors = values[5];
    __pyx_v_tangent = values[6];
    __pyx_v_verbose = values[7];
    __pyx_v_sampler = values[8];
    __pyx_v_nwalkers = values[9];
    __pyx_v_walker_pos = values[10];
    __pyx_v_nsamples = values[11];
    __pyx_v_nprocesses = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference", 0, 6, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1573, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_latent_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 1573, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 1573, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_60mcmc_latent_inference(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_sampler, __pyx_v_nwalkers, __pyx_v_walker_pos, __pyx_v_nsamples, __pyx_v_nprocesses);

  /* "pyross/inference.pyx":1573
 * 
 * 
 *     def mcmc_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,             # <<<<<<<<<<<<<<
 *                               init_priors, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,
 *                               nsamples=1000, nprocesses=0):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_60mcmc_latent_inference(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mcmc_latent_inference", 0);

  /* "pyross/inference.pyx":1584
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         return self.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                       sampler=sampler, nwalkers=nwalkers, walker_pos=walker_pos,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer_mcmc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_obs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_obs));
  __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_fltr));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_param_priors);
  __Pyx_INCREF(__pyx_v_init_priors);
  __Pyx_GIVEREF(__pyx_v_init_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_init_priors);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_contactMatrix, __pyx_v_contactMatrix) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)

  /* "pyross/inference.pyx":1585
 *         """
 *         return self.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,
 *                                       generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,             # <<<<<<<<<<<<<<
 *                                       sampler=sampler, nwalkers=nwalkers, walker_pos=walker_pos,
 *                                       nsamples=nsamples, nprocesses=nprocesses)
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_intervention_fun, Py_None) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_verbose, __pyx_v_verbose) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)

  /* "pyross/inference.pyx":1586
 *         return self.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,
 *                                       generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                       sampler=sampler, nwalkers=nwalkers, walker_pos=walker_pos,             # <<<<<<<<<<<<<<
 *                                       nsamples=nsamples, nprocesses=nprocesses)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_sampler, __pyx_v_sampler) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nwalkers, __pyx_v_nwalkers) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_walker_pos, __pyx_v_walker_pos) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)

  /* "pyross/inference.pyx":1587
 *                                       generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                       sampler=sampler, nwalkers=nwalkers, walker_pos=walker_pos,
 *                                       nsamples=nsamples, nprocesses=nprocesses)             # <<<<<<<<<<<<<<
 * 
 *     def mcmc_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors,
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nsamples, __pyx_v_nsamples) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nprocesses, __pyx_v_nprocesses) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)

  /* "pyross/inference.pyx":1584
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         return self.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=None, intervention_fun=None, tangent=tangent, verbose=verbose,
 *                                       sampler=sampler, nwalkers=nwalkers, walker_pos=walker_pos,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1573
 * 
 * 
 *     def mcmc_latent_inference(self, np.ndarray obs, np.ndarray fltr, double Tf, contactMatrix, param_priors,             # <<<<<<<<<<<<<<
 *                               init_priors, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,
 *                               nsamples=1000, nprocesses=0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_latent_inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1589
 *                                       nsamples=nsamples, nprocesses=nprocesses)
 * 
 *     def mcmc_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                             flat=True, discard=0, thin=1):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_63mcmc_latent_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_62mcmc_latent_inference_process_result[] = "\n        Take the sampler generated by `mcmc_latent_inference` and produce output dictionaries for further use\n        in the pyross framework.\n\n        Note\n        ----\n        This function has been replaced by `pyross.inference.latent_infer_mcmc_process_results` and will be deleted\n        in a future version of pyross. See there for a documentation of the function parameters.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_63mcmc_latent_inference_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_flat = 0;
  PyObject *__pyx_v_discard = 0;
  PyObject *__pyx_v_thin = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mcmc_latent_inference_process_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_flat,&__pyx_n_s_discard,&__pyx_n_s_thin,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":1590
 * 
 *     def mcmc_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors,
 *                                             flat=True, discard=0, thin=1):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `mcmc_latent_inference` and produce output dictionaries for further use
 */
    values[5] = ((PyObject *)Py_True);
    values[6] = ((PyObject *)__pyx_int_0);
    values[7] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference_process_result", 0, 5, 8, 1); __PYX_ERR(0, 1589, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference_process_result", 0, 5, 8, 2); __PYX_ERR(0, 1589, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference_process_result", 0, 5, 8, 3); __PYX_ERR(0, 1589, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference_process_result", 0, 5, 8, 4); __PYX_ERR(0, 1589, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flat);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_discard);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thin);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mcmc_latent_inference_process_result") < 0)) __PYX_ERR(0, 1589, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sampler = values[0];
    __pyx_v_obs = values[1];
    __pyx_v_fltr = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
    __pyx_v_flat = values[5];
    __pyx_v_discard = values[6];
    __pyx_v_thin = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mcmc_latent_inference_process_result", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1589, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_latent_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_62mcmc_latent_inference_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_obs, __pyx_v_fltr, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_flat, __pyx_v_discard, __pyx_v_thin);

  /* "pyross/inference.pyx":1589
 *                                       nsamples=nsamples, nprocesses=nprocesses)
 * 
 *     def mcmc_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                             flat=True, discard=0, thin=1):
 *         """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_62mcmc_latent_inference_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin) {
  PyObject *__pyx_v_output_samples = NULL;
  PyObject *__pyx_v_flat_sample_list = NULL;
  PyObject *__pyx_v_out_dict = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_sublist = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_RefNannySetupContext("mcmc_latent_inference_process_result", 0);

  /* "pyross/inference.pyx":1600
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         output_samples = self.latent_infer_mcmc_process_result(sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                                                contactMatrix=self.contactMatrix, flat=flat,
 *                                                                discard=discard, thin=thin)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer_mcmc_process_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_sampler);
  __Pyx_GIVEREF(__pyx_v_sampler);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sampler);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_GIVEREF(__pyx_v_obs);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);
  __Pyx_GIVEREF(__pyx_v_fltr);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_fltr);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_param_priors);
  __Pyx_INCREF(__pyx_v_init_priors);
  __Pyx_GIVEREF(__pyx_v_init_priors);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_init_priors);

  /* "pyross/inference.pyx":1601
 *         """
 *         output_samples = self.latent_infer_mcmc_process_result(sampler, obs, fltr, param_priors, init_priors,
 *                                                                contactMatrix=self.contactMatrix, flat=flat,             # <<<<<<<<<<<<<<
 *                                                                discard=discard, thin=thin)
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_contactMatrix, __pyx_v_self->contactMatrix) < 0) __PYX_ERR(0, 1601, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_flat, __pyx_v_flat) < 0) __PYX_ERR(0, 1601, __pyx_L1_error)

  /* "pyross/inference.pyx":1602
 *         output_samples = self.latent_infer_mcmc_process_result(sampler, obs, fltr, param_priors, init_priors,
 *                                                                contactMatrix=self.contactMatrix, flat=flat,
 *                                                                discard=discard, thin=thin)             # <<<<<<<<<<<<<<
 * 
 *         # Match old dictionary key names for backward compatibility.
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_discard, __pyx_v_discard) < 0) __PYX_ERR(0, 1601, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_thin, __pyx_v_thin) < 0) __PYX_ERR(0, 1601, __pyx_L1_error)

  /* "pyross/inference.pyx":1600
 *         in a future version of pyross. See there for a documentation of the function parameters.
 *         """
 *         output_samples = self.latent_infer_mcmc_process_result(sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                                                contactMatrix=self.contactMatrix, flat=flat,
 *                                                                discard=discard, thin=thin)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_output_samples = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1605
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         if flat:             # <<<<<<<<<<<<<<
 *             flat_sample_list = output_samples
 *         else:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1605, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "pyross/inference.pyx":1606
 *         # Match old dictionary key names for backward compatibility.
 *         if flat:
 *             flat_sample_list = output_samples             # <<<<<<<<<<<<<<
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 */
    __Pyx_INCREF(__pyx_v_output_samples);
    __pyx_v_flat_sample_list = __pyx_v_output_samples;

    /* "pyross/inference.pyx":1605
 * 
 *         # Match old dictionary key names for backward compatibility.
 *         if flat:             # <<<<<<<<<<<<<<
 *             flat_sample_list = output_samples
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":1608
 *             flat_sample_list = output_samples
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]             # <<<<<<<<<<<<<<
 *         for out_dict in flat_sample_list:
 *             out_dict['map_x0']          = out_dict.pop('x0')
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1608, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_v_output_samples)) || PyTuple_CheckExact(__pyx_v_output_samples)) {
        __pyx_t_3 = __pyx_v_output_samples; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_output_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1608, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1608, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1608, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1608, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1608, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1608, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_7(__pyx_t_3);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1608, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_sublist, __pyx_t_2);
        __pyx_t_2 = 0;
        if (likely(PyList_CheckExact(__pyx_8genexpr2__pyx_v_sublist)) || PyTuple_CheckExact(__pyx_8genexpr2__pyx_v_sublist)) {
          __pyx_t_2 = __pyx_8genexpr2__pyx_v_sublist; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_8genexpr2__pyx_v_sublist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1608, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1608, __pyx_L6_error)
        }
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_2))) {
              if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1608, __pyx_L6_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1608, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            } else {
              if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1608, __pyx_L6_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1608, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            }
          } else {
            __pyx_t_1 = __pyx_t_9(__pyx_t_2);
            if (unlikely(!__pyx_t_1)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1608, __pyx_L6_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_item, __pyx_t_1);
          __pyx_t_1 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_8genexpr2__pyx_v_item))) __PYX_ERR(0, 1608, __pyx_L6_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_item); __pyx_8genexpr2__pyx_v_item = 0;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_sublist); __pyx_8genexpr2__pyx_v_sublist = 0;
      goto __pyx_L11_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_item); __pyx_8genexpr2__pyx_v_item = 0;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_sublist); __pyx_8genexpr2__pyx_v_sublist = 0;
      goto __pyx_L1_error;
      __pyx_L11_exit_scope:;
    } /* exit inner scope */
    __pyx_v_flat_sample_list = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":1609
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 *         for out_dict in flat_sample_list:             # <<<<<<<<<<<<<<
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 */
  if (likely(PyList_CheckExact(__pyx_v_flat_sample_list)) || PyTuple_CheckExact(__pyx_v_flat_sample_list)) {
    __pyx_t_4 = __pyx_v_flat_sample_list; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_flat_sample_list); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1609, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1609, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1609, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1609, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1609, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1609, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_out_dict, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1610
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 *         for out_dict in flat_sample_list:
 *             out_dict['map_x0']          = out_dict.pop('x0')             # <<<<<<<<<<<<<<
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_x0) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_x0);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_map_x0, __pyx_t_3) < 0)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1611
 *         for out_dict in flat_sample_list:
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')             # <<<<<<<<<<<<<<
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_flat_params) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_flat_params);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_flat_map, __pyx_t_3) < 0)) __PYX_ERR(0, 1611, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1612
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')             # <<<<<<<<<<<<<<
 * 
 *         return output_samples
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_u_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_params_dict);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_out_dict, __pyx_n_u_map_params_dict, __pyx_t_3) < 0)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":1609
 *         else:
 *             flat_sample_list = [item for sublist in output_samples for item in sublist]
 *         for out_dict in flat_sample_list:             # <<<<<<<<<<<<<<
 *             out_dict['map_x0']          = out_dict.pop('x0')
 *             out_dict['flat_map']        = out_dict.pop('flat_params')
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1614
 *             out_dict['map_params_dict'] = out_dict.pop('params_dict')
 * 
 *         return output_samples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_samples);
  __pyx_r = __pyx_v_output_samples;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1589
 *                                       nsamples=nsamples, nprocesses=nprocesses)
 * 
 *     def mcmc_latent_inference_process_result(self, sampler, obs, fltr, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                             flat=True, discard=0, thin=1):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.mcmc_latent_inference_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_flat_sample_list);
  __Pyx_XDECREF(__pyx_v_out_dict);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_sublist);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1617
 * 
 * 
 *     def latent_infer_control(self, obs, fltr, Tf, generator, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                             **kwargs):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_65latent_infer_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_64latent_infer_control[] = "\n        Compute the maximum a-posteriori (MAP) estimate of the change of control parameters for a SIR type model in\n        lockdown with partially observed classes.\n\n        Parameters\n        ----------\n            see `latent_infer`\n\n        Returns\n        -------\n        output_dict: dict\n            A dictionary containing the following keys for users:\n\n            map_params_dict: dict\n                dictionary for MAP estimates for control parameters\n            map_x0: np.array\n                MAP estimates for the initial conditions\n            -logp: float\n                Value of -logp at MAP.\n\n        Note\n        ----\n        This function just calls `latent_infer` (with the specified `generator`), will be deprecated.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_65latent_infer_control(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer_control (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_generator,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_control", 1, 6, 6, 1); __PYX_ERR(0, 1617, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_control", 1, 6, 6, 2); __PYX_ERR(0, 1617, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_control", 1, 6, 6, 3); __PYX_ERR(0, 1617, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_control", 1, 6, 6, 4); __PYX_ERR(0, 1617, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_control", 1, 6, 6, 5); __PYX_ERR(0, 1617, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "latent_infer_control") < 0)) __PYX_ERR(0, 1617, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_generator = values[3];
    __pyx_v_param_priors = values[4];
    __pyx_v_init_priors = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer_control", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_control", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_64latent_infer_control(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_generator, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_64latent_infer_control(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_generator, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("latent_infer_control", 0);

  /* "pyross/inference.pyx":1644
 *         """
 * 
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                         contactMatrix=None, generator=generator,
 *                                         **kwargs)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_GIVEREF(__pyx_v_obs);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);
  __Pyx_GIVEREF(__pyx_v_fltr);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_fltr);
  __Pyx_INCREF(__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_v_Tf);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_Tf);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_param_priors);
  __Pyx_INCREF(__pyx_v_init_priors);
  __Pyx_GIVEREF(__pyx_v_init_priors);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_init_priors);

  /* "pyross/inference.pyx":1645
 * 
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors,
 *                                         contactMatrix=None, generator=generator,             # <<<<<<<<<<<<<<
 *                                         **kwargs)
 *         del output_dict['params_dict']
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, Py_None) < 0) __PYX_ERR(0, 1645, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 1645, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1646
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors,
 *                                         contactMatrix=None, generator=generator,
 *                                         **kwargs)             # <<<<<<<<<<<<<<
 *         del output_dict['params_dict']
 *         output_dict['map_params_dict']=output_dict['control_params_dict']  # Rename entry for backwards compatibility
 */
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1646, __pyx_L1_error)

  /* "pyross/inference.pyx":1644
 *         """
 * 
 *         output_dict = self.latent_infer(obs, fltr, Tf, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                         contactMatrix=None, generator=generator,
 *                                         **kwargs)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_output_dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1647
 *                                         contactMatrix=None, generator=generator,
 *                                         **kwargs)
 *         del output_dict['params_dict']             # <<<<<<<<<<<<<<
 *         output_dict['map_params_dict']=output_dict['control_params_dict']  # Rename entry for backwards compatibility
 * 
 */
  if (unlikely(PyObject_DelItem(__pyx_v_output_dict, __pyx_n_u_params_dict) < 0)) __PYX_ERR(0, 1647, __pyx_L1_error)

  /* "pyross/inference.pyx":1648
 *                                         **kwargs)
 *         del output_dict['params_dict']
 *         output_dict['map_params_dict']=output_dict['control_params_dict']  # Rename entry for backwards compatibility             # <<<<<<<<<<<<<<
 * 
 *         return output_dict
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(PyObject_SetItem(__pyx_v_output_dict, __pyx_n_u_map_params_dict, __pyx_t_4) < 0)) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1650
 *         output_dict['map_params_dict']=output_dict['control_params_dict']  # Rename entry for backwards compatibility
 * 
 *         return output_dict             # <<<<<<<<<<<<<<
 * 
 *     def _loglikelihood_latent(self, params, grad=0, generator=None, intervention_fun=None, param_keys=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_dict);
  __pyx_r = __pyx_v_output_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1617
 * 
 * 
 *     def latent_infer_control(self, obs, fltr, Tf, generator, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                             **kwargs):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_control", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1652
 *         return output_dict
 * 
 *     def _loglikelihood_latent(self, params, grad=0, generator=None, intervention_fun=None, param_keys=None,             # <<<<<<<<<<<<<<
 *                               param_guess_range=None, is_scale_parameter=None, scaled_param_guesses=None,
 *                               param_length=None, obs=None, fltr=None, Tf=None, obs0=None, init_flags=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_67_loglikelihood_latent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_67_loglikelihood_latent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_grad = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_param_keys = 0;
  PyObject *__pyx_v_param_guess_range = 0;
  PyObject *__pyx_v_is_scale_parameter = 0;
  PyObject *__pyx_v_scaled_param_guesses = 0;
  PyObject *__pyx_v_param_length = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_obs0 = 0;
  PyObject *__pyx_v_init_flags = 0;
  PyObject *__pyx_v_init_fltrs = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_smooth_penalty = 0;
  PyObject *__pyx_v_bounds = 0;
  PyObject *__pyx_v_inter_steps = 0;
  CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_loglikelihood_latent (wrapper)", 0);
  __pyx_v_catchall_kwargs = PyDict_New(); if (unlikely(!__pyx_v_catchall_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_catchall_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_grad,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_param_keys,&__pyx_n_s_param_guess_range,&__pyx_n_s_is_scale_parameter,&__pyx_n_s_scaled_param_guesses,&__pyx_n_s_param_length,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_obs0,&__pyx_n_s_init_flags,&__pyx_n_s_init_fltrs,&__pyx_n_s_tangent,&__pyx_n_s_smooth_penalty,&__pyx_n_s_bounds,&__pyx_n_s_inter_steps,0};
    PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1653
 * 
 *     def _loglikelihood_latent(self, params, grad=0, generator=None, intervention_fun=None, param_keys=None,
 *                               param_guess_range=None, is_scale_parameter=None, scaled_param_guesses=None,             # <<<<<<<<<<<<<<
 *                               param_length=None, obs=None, fltr=None, Tf=None, obs0=None, init_flags=None,
 *                               init_fltrs=None, tangent=None, smooth_penalty=False, bounds=None, inter_steps=0,
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1654
 *     def _loglikelihood_latent(self, params, grad=0, generator=None, intervention_fun=None, param_keys=None,
 *                               param_guess_range=None, is_scale_parameter=None, scaled_param_guesses=None,
 *                               param_length=None, obs=None, fltr=None, Tf=None, obs0=None, init_flags=None,             # <<<<<<<<<<<<<<
 *                               init_fltrs=None, tangent=None, smooth_penalty=False, bounds=None, inter_steps=0,
 *                               **catchall_kwargs):
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);
    values[13] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1655
 *                               param_guess_range=None, is_scale_parameter=None, scaled_param_guesses=None,
 *                               param_length=None, obs=None, fltr=None, Tf=None, obs0=None, init_flags=None,
 *                               init_fltrs=None, tangent=None, smooth_penalty=False, bounds=None, inter_steps=0,             # <<<<<<<<<<<<<<
 *                               **catchall_kwargs):
 *         if bounds is not None:
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = ((PyObject *)Py_None);
    values[16] = ((PyObject *)Py_False);
    values[17] = ((PyObject *)Py_None);
    values[18] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_keys);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_guess_range);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_scale_parameter);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaled_param_guesses);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_length);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs0);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_flags);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_fltrs);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smooth_penalty);
          if (value) { values[16] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bounds);
          if (value) { values[17] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[18] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_catchall_kwargs, values, pos_args, "_loglikelihood_latent") < 0)) __PYX_ERR(0, 1652, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_grad = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_intervention_fun = values[3];
    __pyx_v_param_keys = values[4];
    __pyx_v_param_guess_range = values[5];
    __pyx_v_is_scale_parameter = values[6];
    __pyx_v_scaled_param_guesses = values[7];
    __pyx_v_param_length = values[8];
    __pyx_v_obs = values[9];
    __pyx_v_fltr = values[10];
    __pyx_v_Tf = values[11];
    __pyx_v_obs0 = values[12];
    __pyx_v_init_flags = values[13];
    __pyx_v_init_fltrs = values[14];
    __pyx_v_tangent = values[15];
    __pyx_v_smooth_penalty = values[16];
    __pyx_v_bounds = values[17];
    __pyx_v_inter_steps = values[18];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_loglikelihood_latent", 0, 1, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1652, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_catchall_kwargs); __pyx_v_catchall_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type._loglikelihood_latent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_66_loglikelihood_latent(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_grad, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_param_keys, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses, __pyx_v_param_length, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_obs0, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_tangent, __pyx_v_smooth_penalty, __pyx_v_bounds, __pyx_v_inter_steps, __pyx_v_catchall_kwargs);

  /* "pyross/inference.pyx":1652
 *         return output_dict
 * 
 *     def _loglikelihood_latent(self, params, grad=0, generator=None, intervention_fun=None, param_keys=None,             # <<<<<<<<<<<<<<
 *                               param_guess_range=None, is_scale_parameter=None, scaled_param_guesses=None,
 *                               param_length=None, obs=None, fltr=None, Tf=None, obs0=None, init_flags=None,
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_catchall_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_66_loglikelihood_latent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_grad, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_param_length, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_obs0, PyObject *__pyx_v_init_flags, PyObject *__pyx_v_init_fltrs, PyObject *__pyx_v_tangent, PyObject *__pyx_v_smooth_penalty, PyObject *__pyx_v_bounds, PyObject *__pyx_v_inter_steps, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs) {
  PyObject *__pyx_v_inits = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_parameters = NULL;
  PyObject *__pyx_v_kwargs = NULL;
  PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_v_logl = NULL;
  double __pyx_v_penalty;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  double __pyx_t_14;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj __pyx_t_15;
  __Pyx_RefNannySetupContext("_loglikelihood_latent", 0);

  /* "pyross/inference.pyx":1657
 *                               init_fltrs=None, tangent=None, smooth_penalty=False, bounds=None, inter_steps=0,
 *                               **catchall_kwargs):
 *         if bounds is not None:             # <<<<<<<<<<<<<<
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):
 */
  __pyx_t_1 = (__pyx_v_bounds != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":1659
 *         if bounds is not None:
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_any); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_params, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_params, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "pyross/inference.pyx":1660
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):
 *                 return -np.Inf             # <<<<<<<<<<<<<<
 * 
 *         inits =  np.copy(params[param_length:])
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Inf); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Negative(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "pyross/inference.pyx":1659
 *         if bounds is not None:
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 * 
 */
    }

    /* "pyross/inference.pyx":1657
 *                               init_fltrs=None, tangent=None, smooth_penalty=False, bounds=None, inter_steps=0,
 *                               **catchall_kwargs):
 *         if bounds is not None:             # <<<<<<<<<<<<<<
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):
 */
  }

  /* "pyross/inference.pyx":1662
 *                 return -np.Inf
 * 
 *         inits =  np.copy(params[param_length:])             # <<<<<<<<<<<<<<
 * 
 *         # Restore parameters from flattened parameters
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_params, 0, 0, &__pyx_v_param_length, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_inits = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1665
 * 
 *         # Restore parameters from flattened parameters
 *         orig_params = pyross.utils.unflatten_parameters(params[:param_length],             # <<<<<<<<<<<<<<
 *                           param_guess_range, is_scale_parameter, scaled_param_guesses)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyross); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_params, 0, 0, NULL, &__pyx_v_param_length, NULL, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "pyross/inference.pyx":1666
 *         # Restore parameters from flattened parameters
 *         orig_params = pyross.utils.unflatten_parameters(params[:param_length],
 *                           param_guess_range, is_scale_parameter, scaled_param_guesses)             # <<<<<<<<<<<<<<
 * 
 *         parameters, kwargs = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 */
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_6, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_6, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_param_guess_range);
    __Pyx_GIVEREF(__pyx_v_param_guess_range);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_param_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_param_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_scaled_param_guesses);
    __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_orig_params = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1668
 *                           param_guess_range, is_scale_parameter, scaled_param_guesses)
 * 
 *         parameters, kwargs = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 * 
 *         self.set_params(parameters)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_param_keys);
  __Pyx_GIVEREF(__pyx_v_param_keys);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_param_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_orig_params);
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 1668, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1668, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1668, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1668, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_parameters = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_kwargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":1670
 *         parameters, kwargs = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 * 
 *         self.set_params(parameters)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pyross/inference.pyx":1672
 *         self.set_params(parameters)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 */
  __pyx_t_2 = (__pyx_v_generator != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":1673
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 *             else:
 */
    __pyx_t_1 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "pyross/inference.pyx":1674
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1674, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__pyx_v_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1674, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
        __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1674, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1674, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1674, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "pyross/inference.pyx":1673
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 *             else:
 */
      goto __pyx_L10;
    }

    /* "pyross/inference.pyx":1676
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)             # <<<<<<<<<<<<<<
 *         else:
 *             if kwargs != {}:
 */
    /*else*/ {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1676, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1676, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1676, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
        __pyx_t_6 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1676, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L10:;

    /* "pyross/inference.pyx":1672
 *         self.set_params(parameters)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**kwargs)
 */
    goto __pyx_L9;
  }

  /* "pyross/inference.pyx":1678
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)
 *         else:
 *             if kwargs != {}:             # <<<<<<<<<<<<<<
 *                 raise Exception('Key error or unspecified generator')
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_kwargs, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1678, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1678, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "pyross/inference.pyx":1679
 *         else:
 *             if kwargs != {}:
 *                 raise Exception('Key error or unspecified generator')             # <<<<<<<<<<<<<<
 * 
 *         x0 = self._construct_inits(inits, init_flags, init_fltrs, obs0, fltr[0])
 */
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 1679, __pyx_L1_error)

      /* "pyross/inference.pyx":1678
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **kwargs)
 *         else:
 *             if kwargs != {}:             # <<<<<<<<<<<<<<
 *                 raise Exception('Key error or unspecified generator')
 * 
 */
    }
  }
  __pyx_L9:;

  /* "pyross/inference.pyx":1681
 *                 raise Exception('Key error or unspecified generator')
 * 
 *         x0 = self._construct_inits(inits, init_flags, init_fltrs, obs0, fltr[0])             # <<<<<<<<<<<<<<
 *         logl = 0
 *         if smooth_penalty == True:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_fltr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_inits, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_4};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_inits, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_4};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_inits);
    __Pyx_GIVEREF(__pyx_v_inits);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_inits);
    __Pyx_INCREF(__pyx_v_init_flags);
    __Pyx_GIVEREF(__pyx_v_init_flags);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_init_flags);
    __Pyx_INCREF(__pyx_v_init_fltrs);
    __Pyx_GIVEREF(__pyx_v_init_fltrs);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_init_fltrs);
    __Pyx_INCREF(__pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_v_obs0);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_7, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_x0 = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":1682
 * 
 *         x0 = self._construct_inits(inits, init_flags, init_fltrs, obs0, fltr[0])
 *         logl = 0             # <<<<<<<<<<<<<<
 *         if smooth_penalty == True:
 *             # Steer the global optimiser away from regions with negative initial values.
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_logl = __pyx_int_0;

  /* "pyross/inference.pyx":1683
 *         x0 = self._construct_inits(inits, init_flags, init_fltrs, obs0, fltr[0])
 *         logl = 0
 *         if smooth_penalty == True:             # <<<<<<<<<<<<<<
 *             # Steer the global optimiser away from regions with negative initial values.
 *             penalty = self._penalty_from_negative_values(x0)
 */
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_smooth_penalty, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1683, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":1685
 *         if smooth_penalty == True:
 *             # Steer the global optimiser away from regions with negative initial values.
 *             penalty = self._penalty_from_negative_values(x0)             # <<<<<<<<<<<<<<
 *             x0[x0<0] = 0.1/self.Omega # set to be small and positive
 *             logl -= penalty*fltr.shape[0]
 */
    if (!(likely(((__pyx_v_x0) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x0, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1685, __pyx_L1_error)
    __pyx_v_penalty = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_penalty_from_negative_values(__pyx_v_self, ((PyArrayObject *)__pyx_v_x0));

    /* "pyross/inference.pyx":1686
 *             # Steer the global optimiser away from regions with negative initial values.
 *             penalty = self._penalty_from_negative_values(x0)
 *             x0[x0<0] = 0.1/self.Omega # set to be small and positive             # <<<<<<<<<<<<<<
 *             logl -= penalty*fltr.shape[0]
 *         elif smooth_penalty == False:
 */
    __pyx_t_6 = PyFloat_FromDouble((0.1 / __pyx_v_self->Omega)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_x0, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1686, __pyx_L1_error)
    if (unlikely(PyObject_SetItem(__pyx_v_x0, __pyx_t_3, __pyx_t_6) < 0)) __PYX_ERR(0, 1686, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pyross/inference.pyx":1687
 *             penalty = self._penalty_from_negative_values(x0)
 *             x0[x0<0] = 0.1/self.Omega # set to be small and positive
 *             logl -= penalty*fltr.shape[0]             # <<<<<<<<<<<<<<
 *         elif smooth_penalty == False:
 *             # Return -Inf if one of the initial values is negative.
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_penalty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fltr, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_v_logl, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_logl, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":1683
 *         x0 = self._construct_inits(inits, init_flags, init_fltrs, obs0, fltr[0])
 *         logl = 0
 *         if smooth_penalty == True:             # <<<<<<<<<<<<<<
 *             # Steer the global optimiser away from regions with negative initial values.
 *             penalty = self._penalty_from_negative_values(x0)
 */
    goto __pyx_L12;
  }

  /* "pyross/inference.pyx":1688
 *             x0[x0<0] = 0.1/self.Omega # set to be small and positive
 *             logl -= penalty*fltr.shape[0]
 *         elif smooth_penalty == False:             # <<<<<<<<<<<<<<
 *             # Return -Inf if one of the initial values is negative.
 *             if not self._all_positive(x0):
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_smooth_penalty, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":1690
 *         elif smooth_penalty == False:
 *             # Return -Inf if one of the initial values is negative.
 *             if not self._all_positive(x0):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 *         # We also support `smooth_penalty == None`, which is useful for example for computing the Hessian.
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_all_positive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_x0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_x0);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = ((!__pyx_t_2) != 0);
    if (__pyx_t_1) {

      /* "pyross/inference.pyx":1691
 *             # Return -Inf if one of the initial values is negative.
 *             if not self._all_positive(x0):
 *                 return -np.Inf             # <<<<<<<<<<<<<<
 *         # We also support `smooth_penalty == None`, which is useful for example for computing the Hessian.
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Inf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "pyross/inference.pyx":1690
 *         elif smooth_penalty == False:
 *             # Return -Inf if one of the initial values is negative.
 *             if not self._all_positive(x0):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 *         # We also support `smooth_penalty == None`, which is useful for example for computing the Hessian.
 */
    }

    /* "pyross/inference.pyx":1688
 *             x0[x0<0] = 0.1/self.Omega # set to be small and positive
 *             logl -= penalty*fltr.shape[0]
 *         elif smooth_penalty == False:             # <<<<<<<<<<<<<<
 *             # Return -Inf if one of the initial values is negative.
 *             if not self._all_positive(x0):
 */
  }
  __pyx_L12:;

  /* "pyross/inference.pyx":1694
 *         # We also support `smooth_penalty == None`, which is useful for example for computing the Hessian.
 * 
 *         logl += -self._obtain_logp_for_lat_traj(x0, obs, fltr[1:], Tf, tangent, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         return logl
 * 
 */
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_x0, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1694, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_obs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1694, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_fltr, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1694, __pyx_L1_error)
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L1_error)
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_inter_steps); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L1_error)
  __pyx_t_15.__pyx_n = 2;
  __pyx_t_15.tangent = __pyx_v_tangent;
  __pyx_t_15.inter_steps = __pyx_t_13;
  __pyx_t_14 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_obtain_logp_for_lat_traj(__pyx_v_self, __pyx_t_10, __pyx_t_11, ((PyArrayObject *)__pyx_t_5), __pyx_t_12, &__pyx_t_15); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble((-__pyx_t_14)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_logl, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_logl, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1695
 * 
 *         logl += -self._obtain_logp_for_lat_traj(x0, obs, fltr[1:], Tf, tangent, inter_steps=inter_steps)
 *         return logl             # <<<<<<<<<<<<<<
 * 
 *     def _logposterior_latent(self, params, prior=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_logl);
  __pyx_r = __pyx_v_logl;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1652
 *         return output_dict
 * 
 *     def _loglikelihood_latent(self, params, grad=0, generator=None, intervention_fun=None, param_keys=None,             # <<<<<<<<<<<<<<
 *                               param_guess_range=None, is_scale_parameter=None, scaled_param_guesses=None,
 *                               param_length=None, obs=None, fltr=None, Tf=None, obs0=None, init_flags=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._loglikelihood_latent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_inits);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_logl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1697
 *         return logl
 * 
 *     def _logposterior_latent(self, params, prior=None,             # <<<<<<<<<<<<<<
 *                              **logl_kwargs):
 *         logl = self._loglikelihood_latent(params, **logl_kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_69_logposterior_latent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_69_logposterior_latent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  PyObject *__pyx_v_prior = 0;
  PyObject *__pyx_v_logl_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_logposterior_latent (wrapper)", 0);
  __pyx_v_logl_kwargs = PyDict_New(); if (unlikely(!__pyx_v_logl_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_logl_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_prior,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prior);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_logl_kwargs, values, pos_args, "_logposterior_latent") < 0)) __PYX_ERR(0, 1697, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_prior = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_logposterior_latent", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1697, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_logl_kwargs); __pyx_v_logl_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type._logposterior_latent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_68_logposterior_latent(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_prior, __pyx_v_logl_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_logl_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_68_logposterior_latent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, PyObject *__pyx_v_prior, PyObject *__pyx_v_logl_kwargs) {
  PyObject *__pyx_v_logl = NULL;
  PyObject *__pyx_v_logp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_logposterior_latent", 0);

  /* "pyross/inference.pyx":1699
 *     def _logposterior_latent(self, params, prior=None,
 *                              **logl_kwargs):
 *         logl = self._loglikelihood_latent(params, **logl_kwargs)             # <<<<<<<<<<<<<<
 *         logp = logl + np.sum(prior.logpdf(params))
 *         return logp
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglikelihood_latent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_params);
  __Pyx_GIVEREF(__pyx_v_params);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_params);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_logl_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_logl = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":1700
 *                              **logl_kwargs):
 *         logl = self._loglikelihood_latent(params, **logl_kwargs)
 *         logp = logl + np.sum(prior.logpdf(params))             # <<<<<<<<<<<<<<
 *         return logp
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_params) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_params);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_v_logl, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_logp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1701
 *         logl = self._loglikelihood_latent(params, **logl_kwargs)
 *         logp = logl + np.sum(prior.logpdf(params))
 *         return logp             # <<<<<<<<<<<<<<
 * 
 *     def _latent_infer_to_minimize(self, params, grad=0,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_logp);
  __pyx_r = __pyx_v_logp;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1697
 *         return logl
 * 
 *     def _logposterior_latent(self, params, prior=None,             # <<<<<<<<<<<<<<
 *                              **logl_kwargs):
 *         logl = self._loglikelihood_latent(params, **logl_kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SIR_type._logposterior_latent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logl);
  __Pyx_XDECREF(__pyx_v_logp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1703
 *         return logp
 * 
 *     def _latent_infer_to_minimize(self, params, grad=0,             # <<<<<<<<<<<<<<
 *                                    **logp_kwargs):
 *         """Objective function for minimization call in latent_infer."""
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_71_latent_infer_to_minimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_70_latent_infer_to_minimize[] = "Objective function for minimization call in latent_infer.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_71_latent_infer_to_minimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_grad = 0;
  PyObject *__pyx_v_logp_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_latent_infer_to_minimize (wrapper)", 0);
  __pyx_v_logp_kwargs = PyDict_New(); if (unlikely(!__pyx_v_logp_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_logp_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_grad,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_logp_kwargs, values, pos_args, "_latent_infer_to_minimize") < 0)) __PYX_ERR(0, 1703, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_grad = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_latent_infer_to_minimize", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1703, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_logp_kwargs); __pyx_v_logp_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type._latent_infer_to_minimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_70_latent_infer_to_minimize(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_grad, __pyx_v_logp_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_logp_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_70_latent_infer_to_minimize(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_grad, PyObject *__pyx_v_logp_kwargs) {
  PyObject *__pyx_v_logp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_latent_infer_to_minimize", 0);

  /* "pyross/inference.pyx":1706
 *                                    **logp_kwargs):
 *         """Objective function for minimization call in latent_infer."""
 *         if 'disable_penalty' in logp_kwargs:             # <<<<<<<<<<<<<<
 *             logp = self._logposterior_latent(params, smooth_penalty=None,  **logp_kwargs)
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_n_u_disable_penalty, __pyx_v_logp_kwargs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1706, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":1707
 *         """Objective function for minimization call in latent_infer."""
 *         if 'disable_penalty' in logp_kwargs:
 *             logp = self._logposterior_latent(params, smooth_penalty=None,  **logp_kwargs)             # <<<<<<<<<<<<<<
 *         else:
 *             logp = self._logposterior_latent(params, smooth_penalty=True,  **logp_kwargs)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior_latent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_params);
    __Pyx_GIVEREF(__pyx_v_params);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_params);
    __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_smooth_penalty, Py_None) < 0) __PYX_ERR(0, 1707, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
    __pyx_t_6 = 0;
    if (__Pyx_MergeKeywords(__pyx_t_5, __pyx_v_logp_kwargs) < 0) __PYX_ERR(0, 1707, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_logp = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":1706
 *                                    **logp_kwargs):
 *         """Objective function for minimization call in latent_infer."""
 *         if 'disable_penalty' in logp_kwargs:             # <<<<<<<<<<<<<<
 *             logp = self._logposterior_latent(params, smooth_penalty=None,  **logp_kwargs)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":1709
 *             logp = self._logposterior_latent(params, smooth_penalty=None,  **logp_kwargs)
 *         else:
 *             logp = self._logposterior_latent(params, smooth_penalty=True,  **logp_kwargs)             # <<<<<<<<<<<<<<
 *         return -logp
 * 
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior_latent); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_params);
    __Pyx_GIVEREF(__pyx_v_params);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_params);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_smooth_penalty, Py_True) < 0) __PYX_ERR(0, 1709, __pyx_L1_error)
    __pyx_t_4 = __pyx_t_3;
    __pyx_t_3 = 0;
    if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_v_logp_kwargs) < 0) __PYX_ERR(0, 1709, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_logp = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":1710
 *         else:
 *             logp = self._logposterior_latent(params, smooth_penalty=True,  **logp_kwargs)
 *         return -logp             # <<<<<<<<<<<<<<
 * 
 *     def latent_infer(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyNumber_Negative(__pyx_v_logp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1703
 *         return logp
 * 
 *     def _latent_infer_to_minimize(self, params, grad=0,             # <<<<<<<<<<<<<<
 *                                    **logp_kwargs):
 *         """Objective function for minimization call in latent_infer."""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyross.inference.SIR_type._latent_infer_to_minimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1712
 *         return -logp
 * 
 *     def latent_infer(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                      contactMatrix=None, generator=None,
 *                      intervention_fun=None, tangent=False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_73latent_infer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_72latent_infer[] = "\n        Compute the maximum a-posteriori (MAP) estimate for the initial conditions and all desired parameters, including control parameters,\n        for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            Total time of the trajectory\n        param_priors: dict\n            A dictionary that specifies priors for parameters (including control parameters, if desired). See `infer` for further explanations.\n        init_priors: dict\n            A dictionary for priors for initial conditions. See below for examples\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is false"".\n        verbose: bool, optional\n            Set to True to see intermediate outputs from the optimizer.\n        ftol: double\n            Relative tolerance of logp\n        global_max_iter: int, optional\n            Number of global optimisations performed.\n        local_max_iter: int, optional\n            Number of local optimisation performed.\n        global_atol: float\n            The absolute tolerance for global minimisation.\n        enable_global: bool, optional\n            Set to True to enable global optimisation.\n        enable_local: bool, optional\n            Set to True to enable local optimisation.\n        cma_processes: int, optional\n            Number of parallel processes used for global optimisation.\n        cma_population: int, optional\n            The number of samples used in each step of the CMA algorithm.\n        cma_random_seed: int (between 0 and 2**32-1)\n            Random seed for the optimisation algorithms. By default it is generated from numpy.random.randint.\n\n        Returns\n        -------\n        output_dict: dict\n            A dictionary containing the following keys for users:\n\n            x0: np.array\n                MAP estimates for the initial conditions\n            params_dict: dict\n                dictionary for MAP estimates for model parameters\n            control_params_dict: dict\n                dictionary for MAP estimates for control parameters (if requested)\n            -logp: float\n                Value of -logp at MAP.\n\n        Note\n        ----\n        This function combines the functionality of `latent_infer_parameters` and `latent_infer_control`,\n        which will be deprecated.\n        To infer model parameters only, specify a fixed `contactMatrix` function.\n        To infer control parameters only, specify a `generator` and do not specify priors for model parameters.\n\n        Examples\n        --------\n        Here we list three examples, one for inferring all initial"" conditions\n        along the fastest growing linear mode, one for inferring the initial\n        conditions individually and a mixed one.\n\n        First, suppose we only observe Is out of (S, Ia, Is) and we wish to\n        infer all compartmental values of S and Ia independently. For two age\n        groups with population [2500, 7500],\n\n        >>> init_priors = {\n                'independent':{\n                    'fltr': [True, True, True, True, False, False],\n                    'mean': [2400, 7400, 50, 50],\n                    'std': [200, 200, 200, 200],\n                    'bounds': [[2000, 2500], [7000, 7500], [0, 400], [0, 400]]\n                }\n            }\n\n        In the 'fltr' entry, we need a boolean array indicating which components\n        of the full x0 = [S0[0], S0[1], Ia0[0], Ia0[1], Is0[0], Ia0[1]] array we are inferring.\n        By setting fltr = [True, True, True, True, False, False], the inference algorithm\n        will know that we are inferring all components of S0 and Ia0 but not Is0.\n        Similar to inference for parameter values, we also assume a log-normal\n        distribution for the priors for the initial conditions.\n\n        Next, if we are happy to assume that all our initial conditions lie\n        along the fastest growing linear mode and we will only infer the\n        coefficient of the mode, the init_priors dict would be,\n\n        >>> init_priors = {\n                'lin_mode_coeff':{\n                    'fltr': [True, True, True, True, False, False],\n                    'mean': 100,\n                    'std': 100,\n                    'bounds': [1, 1000]\n                }\n            }\n\n        Note that the 'fltr' entry is still the same as before because we still\n        only want to infer S and Ia, and the initial conditions for Is is fixed\n        by the observation.\n\n        Finally, if we want to do a mixture of both (useful when some compartments\n        have aligned with the fa""stest growing mode but others haven't), we need\n        to set the init_priors to be,\n\n        >>> init_priors = {\n                'lin_mode_coeff': {\n                    'fltr': [True, True, False, False, False, False],\n                    'mean': 100,\n                    'std': 100,\n                    'bounds': [1, 1000]\n                },\n                'independent':{\n                    'fltr': [False, False, True, True, False, False],\n                    'mean': [50, 50],\n                    'std': [200, 200],\n                    'bounds': [0, 400], [0, 400]\n                }\n            }\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_73latent_infer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_ftol = 0;
  PyObject *__pyx_v_global_max_iter = 0;
  PyObject *__pyx_v_local_max_iter = 0;
  PyObject *__pyx_v_global_atol = 0;
  PyObject *__pyx_v_enable_global = 0;
  PyObject *__pyx_v_enable_local = 0;
  PyObject *__pyx_v_cma_processes = 0;
  PyObject *__pyx_v_cma_population = 0;
  PyObject *__pyx_v_cma_random_seed = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_ftol,&__pyx_n_s_global_max_iter,&__pyx_n_s_local_max_iter,&__pyx_n_s_global_atol,&__pyx_n_s_enable_global,&__pyx_n_s_enable_local,&__pyx_n_s_cma_processes,&__pyx_n_s_cma_population,&__pyx_n_s_cma_random_seed,0};
    PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":1713
 * 
 *     def latent_infer(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors,
 *                      contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                      intervention_fun=None, tangent=False,
 *                      verbose=False, ftol=1e-5, global_max_iter=100,
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1714
 *     def latent_infer(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors,
 *                      contactMatrix=None, generator=None,
 *                      intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                      verbose=False, ftol=1e-5, global_max_iter=100,
 *                      local_max_iter=100, global_atol=1., enable_global=True,
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_False);

    /* "pyross/inference.pyx":1715
 *                      contactMatrix=None, generator=None,
 *                      intervention_fun=None, tangent=False,
 *                      verbose=False, ftol=1e-5, global_max_iter=100,             # <<<<<<<<<<<<<<
 *                      local_max_iter=100, global_atol=1., enable_global=True,
 *                      enable_local=True, cma_processes=0, cma_population=16, cma_random_seed=None):
 */
    values[9] = ((PyObject *)Py_False);
    values[10] = ((PyObject *)__pyx_float_1eneg_5);
    values[11] = ((PyObject *)__pyx_int_100);
    values[12] = ((PyObject *)__pyx_int_100);
    values[13] = ((PyObject *)__pyx_float_1_);

    /* "pyross/inference.pyx":1716
 *                      intervention_fun=None, tangent=False,
 *                      verbose=False, ftol=1e-5, global_max_iter=100,
 *                      local_max_iter=100, global_atol=1., enable_global=True,             # <<<<<<<<<<<<<<
 *                      enable_local=True, cma_processes=0, cma_population=16, cma_random_seed=None):
 *         """
 */
    values[14] = ((PyObject *)Py_True);

    /* "pyross/inference.pyx":1717
 *                      verbose=False, ftol=1e-5, global_max_iter=100,
 *                      local_max_iter=100, global_atol=1., enable_global=True,
 *                      enable_local=True, cma_processes=0, cma_population=16, cma_random_seed=None):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the maximum a-posteriori (MAP) estimate for the initial conditions and all desired parameters, including control parameters,
 */
    values[15] = ((PyObject *)Py_True);
    values[16] = ((PyObject *)__pyx_int_0);
    values[17] = ((PyObject *)__pyx_int_16);
    values[18] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer", 0, 5, 19, 1); __PYX_ERR(0, 1712, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer", 0, 5, 19, 2); __PYX_ERR(0, 1712, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer", 0, 5, 19, 3); __PYX_ERR(0, 1712, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer", 0, 5, 19, 4); __PYX_ERR(0, 1712, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ftol);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_max_iter);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_local_max_iter);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_global_atol);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enable_global);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enable_local);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cma_processes);
          if (value) { values[16] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cma_population);
          if (value) { values[17] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cma_random_seed);
          if (value) { values[18] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "latent_infer") < 0)) __PYX_ERR(0, 1712, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = ((PyArrayObject *)values[0]);
    __pyx_v_fltr = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
    __pyx_v_tangent = values[8];
    __pyx_v_verbose = values[9];
    __pyx_v_ftol = values[10];
    __pyx_v_global_max_iter = values[11];
    __pyx_v_local_max_iter = values[12];
    __pyx_v_global_atol = values[13];
    __pyx_v_enable_global = values[14];
    __pyx_v_enable_local = values[15];
    __pyx_v_cma_processes = values[16];
    __pyx_v_cma_population = values[17];
    __pyx_v_cma_random_seed = values[18];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer", 0, 5, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1712, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 1712, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 1712, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_72latent_infer(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_ftol, __pyx_v_global_max_iter, __pyx_v_local_max_iter, __pyx_v_global_atol, __pyx_v_enable_global, __pyx_v_enable_local, __pyx_v_cma_processes, __pyx_v_cma_population, __pyx_v_cma_random_seed);

  /* "pyross/inference.pyx":1712
 *         return -logp
 * 
 *     def latent_infer(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                      contactMatrix=None, generator=None,
 *                      intervention_fun=None, tangent=False,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_72latent_infer(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_ftol, PyObject *__pyx_v_global_max_iter, PyObject *__pyx_v_local_max_iter, PyObject *__pyx_v_global_atol, PyObject *__pyx_v_enable_global, PyObject *__pyx_v_enable_local, PyObject *__pyx_v_cma_processes, PyObject *__pyx_v_cma_population, PyObject *__pyx_v_cma_random_seed) {
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_param_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_param_guess = NULL;
  PyObject *__pyx_v_param_stds = NULL;
  PyObject *__pyx_v_param_bounds = NULL;
  PyObject *__pyx_v_param_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_param_guesses = NULL;
  PyObject *__pyx_v_init_prior_names = NULL;
  PyObject *__pyx_v_init_guess = NULL;
  PyObject *__pyx_v_init_stds = NULL;
  PyObject *__pyx_v_init_bounds = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_param_length = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_cma_stds = NULL;
  PyObject *__pyx_v_minimize_args = NULL;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_estimates = NULL;
  PyObject *__pyx_v_param_estimates = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_init_estimates = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_map_x0 = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("latent_infer", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_obs);
  __Pyx_INCREF((PyObject *)__pyx_v_fltr);

  /* "pyross/inference.pyx":1857
 * 
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1860
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, ((PyObject *)__pyx_v_fltr));
    __Pyx_INCREF(((PyObject *)__pyx_v_obs));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, ((PyObject *)__pyx_v_obs));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1860, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 1860, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1860, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1860, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1860, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_fltr, ((PyArrayObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_v_obs0 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":1865
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 * 
 *         # Read in initial conditions priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_check_length, __pyx_t_2) < 0) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1863, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1863, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
    __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_12)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_12); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_12), 8) < 0) __PYX_ERR(0, 1863, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1863, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }

  /* "pyross/inference.pyx":1863
 * 
 *         # Read in parameter priors
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \             # <<<<<<<<<<<<<<
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_param_prior_names = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_keys = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_param_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_param_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_param_bounds = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_param_guess_range = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_scaled_param_guesses = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "pyross/inference.pyx":1869
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 * 
 *         # Concatenate the flattend parameter guess with init guess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pyross); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_utils); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_13 = PyObject_Length(__pyx_v_obs0); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1869, __pyx_L1_error)
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1869, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1869, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_t_9);
    __pyx_t_10 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1868, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1868, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
    __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_3); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 6) < 0) __PYX_ERR(0, 1868, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1868, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }

  /* "pyross/inference.pyx":1868
 * 
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 * 
 */
  __pyx_v_init_prior_names = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_init_guess = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_init_stds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_init_bounds = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_init_flags = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_init_fltrs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1872
 * 
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]             # <<<<<<<<<<<<<<
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_param_guess, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_param_length = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1873
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_guess);
  __Pyx_GIVEREF(__pyx_v_param_guess);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_guess);
  __Pyx_INCREF(__pyx_v_init_guess);
  __Pyx_GIVEREF(__pyx_v_init_guess);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_guess);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1874
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_stds);
  __Pyx_GIVEREF(__pyx_v_param_stds);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_param_stds);
  __Pyx_INCREF(__pyx_v_init_stds);
  __Pyx_GIVEREF(__pyx_v_init_stds);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_init_stds);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1875
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_bounds);
  __Pyx_GIVEREF(__pyx_v_param_bounds);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_bounds);
  __Pyx_INCREF(__pyx_v_init_bounds);
  __Pyx_GIVEREF(__pyx_v_init_bounds);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_bounds);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1875, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1877
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 *         cma_stds = np.minimum(stds, (bounds[:, 1]-bounds[:, 0])/3)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Add(__pyx_v_param_prior_names, __pyx_v_init_prior_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1877, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1877, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_prior = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1878
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 *         cma_stds = np.minimum(stds, (bounds[:, 1]-bounds[:, 0])/3)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_minimum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_2, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_stds, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1878, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_stds, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1878, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_v_stds);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_cma_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1881
 * 
 * 
 *         minimize_args = {'generator':generator, 'intervention_fun':intervention_fun,             # <<<<<<<<<<<<<<
 *                        'param_keys':keys, 'param_guess_range':param_guess_range,
 *                        'is_scale_parameter':is_scale_parameter,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1882
 * 
 *         minimize_args = {'generator':generator, 'intervention_fun':intervention_fun,
 *                        'param_keys':keys, 'param_guess_range':param_guess_range,             # <<<<<<<<<<<<<<
 *                        'is_scale_parameter':is_scale_parameter,
 *                        'scaled_param_guesses':scaled_param_guesses,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1883
 *         minimize_args = {'generator':generator, 'intervention_fun':intervention_fun,
 *                        'param_keys':keys, 'param_guess_range':param_guess_range,
 *                        'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                        'scaled_param_guesses':scaled_param_guesses,
 *                        'param_length':param_length,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1884
 *                        'param_keys':keys, 'param_guess_range':param_guess_range,
 *                        'is_scale_parameter':is_scale_parameter,
 *                        'scaled_param_guesses':scaled_param_guesses,             # <<<<<<<<<<<<<<
 *                        'param_length':param_length,
 *                        'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1885
 *                        'is_scale_parameter':is_scale_parameter,
 *                        'scaled_param_guesses':scaled_param_guesses,
 *                        'param_length':param_length,             # <<<<<<<<<<<<<<
 *                        'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 *                        'init_flags':init_flags, 'init_fltrs': init_fltrs,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1886
 *                        'scaled_param_guesses':scaled_param_guesses,
 *                        'param_length':param_length,
 *                        'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,             # <<<<<<<<<<<<<<
 *                        'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                        'prior':prior, 'tangent':tangent}
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs, ((PyObject *)__pyx_v_obs)) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fltr, ((PyObject *)__pyx_v_fltr)) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs0, __pyx_v_obs0) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1887
 *                        'param_length':param_length,
 *                        'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 *                        'init_flags':init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *                        'prior':prior, 'tangent':tangent}
 *         res = minimization(self._latent_infer_to_minimize,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)

  /* "pyross/inference.pyx":1888
 *                        'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 *                        'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                        'prior':prior, 'tangent':tangent}             # <<<<<<<<<<<<<<
 *         res = minimization(self._latent_infer_to_minimize,
 *                           guess, bounds, ftol=ftol,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
  __pyx_v_minimize_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":1889
 *                        'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                        'prior':prior, 'tangent':tangent}
 *         res = minimization(self._latent_infer_to_minimize,             # <<<<<<<<<<<<<<
 *                           guess, bounds, ftol=ftol,
 *                           global_max_iter=global_max_iter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_minimization); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_infer_to_minimize); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);

  /* "pyross/inference.pyx":1890
 *                        'prior':prior, 'tangent':tangent}
 *         res = minimization(self._latent_infer_to_minimize,
 *                           guess, bounds, ftol=ftol,             # <<<<<<<<<<<<<<
 *                           global_max_iter=global_max_iter,
 *                           local_max_iter=local_max_iter, global_atol=global_atol,
 */
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_guess);
  __Pyx_GIVEREF(__pyx_v_guess);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_guess);
  __Pyx_INCREF(__pyx_v_bounds);
  __Pyx_GIVEREF(__pyx_v_bounds);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_bounds);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_ftol, __pyx_v_ftol) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1891
 *         res = minimization(self._latent_infer_to_minimize,
 *                           guess, bounds, ftol=ftol,
 *                           global_max_iter=global_max_iter,             # <<<<<<<<<<<<<<
 *                           local_max_iter=local_max_iter, global_atol=global_atol,
 *                           enable_global=enable_global, enable_local=enable_local,
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_global_max_iter, __pyx_v_global_max_iter) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1892
 *                           guess, bounds, ftol=ftol,
 *                           global_max_iter=global_max_iter,
 *                           local_max_iter=local_max_iter, global_atol=global_atol,             # <<<<<<<<<<<<<<
 *                           enable_global=enable_global, enable_local=enable_local,
 *                           cma_processes=cma_processes,
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_local_max_iter, __pyx_v_local_max_iter) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_global_atol, __pyx_v_global_atol) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1893
 *                           global_max_iter=global_max_iter,
 *                           local_max_iter=local_max_iter, global_atol=global_atol,
 *                           enable_global=enable_global, enable_local=enable_local,             # <<<<<<<<<<<<<<
 *                           cma_processes=cma_processes,
 *                           cma_population=cma_population, cma_stds=cma_stds,
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_enable_global, __pyx_v_enable_global) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_enable_local, __pyx_v_enable_local) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1894
 *                           local_max_iter=local_max_iter, global_atol=global_atol,
 *                           enable_global=enable_global, enable_local=enable_local,
 *                           cma_processes=cma_processes,             # <<<<<<<<<<<<<<
 *                           cma_population=cma_population, cma_stds=cma_stds,
 *                           verbose=verbose, cma_random_seed=cma_random_seed, args_dict=minimize_args)
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_cma_processes, __pyx_v_cma_processes) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1895
 *                           enable_global=enable_global, enable_local=enable_local,
 *                           cma_processes=cma_processes,
 *                           cma_population=cma_population, cma_stds=cma_stds,             # <<<<<<<<<<<<<<
 *                           verbose=verbose, cma_random_seed=cma_random_seed, args_dict=minimize_args)
 *         estimates = res[0]
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_cma_population, __pyx_v_cma_population) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_cma_stds, __pyx_v_cma_stds) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1896
 *                           cma_processes=cma_processes,
 *                           cma_population=cma_population, cma_stds=cma_stds,
 *                           verbose=verbose, cma_random_seed=cma_random_seed, args_dict=minimize_args)             # <<<<<<<<<<<<<<
 *         estimates = res[0]
 * 
 */
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_verbose, __pyx_v_verbose) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_cma_random_seed, __pyx_v_cma_random_seed) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_args_dict, __pyx_v_minimize_args) < 0) __PYX_ERR(0, 1890, __pyx_L1_error)

  /* "pyross/inference.pyx":1889
 *                        'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                        'prior':prior, 'tangent':tangent}
 *         res = minimization(self._latent_infer_to_minimize,             # <<<<<<<<<<<<<<
 *                           guess, bounds, ftol=ftol,
 *                           global_max_iter=global_max_iter,
 */
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_res = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1897
 *                           cma_population=cma_population, cma_stds=cma_stds,
 *                           verbose=verbose, cma_random_seed=cma_random_seed, args_dict=minimize_args)
 *         estimates = res[0]             # <<<<<<<<<<<<<<
 * 
 *         # Get the parameters (in their original structure) from the flattened parameter vector.
 */
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v_estimates = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1900
 * 
 *         # Get the parameters (in their original structure) from the flattened parameter vector.
 *         param_estimates = estimates[:param_length]             # <<<<<<<<<<<<<<
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,
 *                                                       param_guess_range,
 */
  __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_estimates, 0, 0, NULL, &__pyx_v_param_length, NULL, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v_param_estimates = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1901
 *         # Get the parameters (in their original structure) from the flattened parameter vector.
 *         param_estimates = estimates[:param_length]
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,             # <<<<<<<<<<<<<<
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pyross); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_utils); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1904
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 *                                                       scaled_param_guesses)             # <<<<<<<<<<<<<<
 *         init_estimates = estimates[param_length:]
 * 
 */
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_9);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_9);
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_param_estimates);
    __Pyx_GIVEREF(__pyx_v_param_estimates);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_v_param_estimates);
    __Pyx_INCREF(__pyx_v_param_guess_range);
    __Pyx_GIVEREF(__pyx_v_param_guess_range);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_v_param_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_param_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
    PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_4, __pyx_v_scaled_param_guesses);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_orig_params = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1905
 *                                                       is_scale_parameter,
 *                                                       scaled_param_guesses)
 *         init_estimates = estimates[param_length:]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_estimates, 0, 0, &__pyx_v_param_length, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v_init_estimates = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1908
 * 
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *         self.set_params(map_params_dict)
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_keys);
  __Pyx_GIVEREF(__pyx_v_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_orig_params);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 1908, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
    PyObject* sequence = __pyx_t_8;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1908, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_10);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    #endif
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_10 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < 0) __PYX_ERR(0, 1908, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1908, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }
  __pyx_v_map_params_dict = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_map_control_params_dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":1909
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 *         self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_1, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1911
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  __pyx_t_14 = (__pyx_v_generator != Py_None);
  __pyx_t_15 = (__pyx_t_14 != 0);
  if (__pyx_t_15) {

    /* "pyross/inference.pyx":1912
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
    __pyx_t_15 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_14 = (__pyx_t_15 != 0);
    if (__pyx_t_14) {

      /* "pyross/inference.pyx":1913
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1913, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_10 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1913, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      } else {
        __pyx_t_10 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1913, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":1912
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
      goto __pyx_L12;
    }

    /* "pyross/inference.pyx":1915
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 *         map_x0 = self._construct_inits(init_estimates, init_flags, init_fltrs,
 *                                     obs0, fltr[0])
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1915, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_8 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1915, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_8 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1915, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GIVEREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __pyx_L12:;

    /* "pyross/inference.pyx":1911
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  }

  /* "pyross/inference.pyx":1916
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 *         map_x0 = self._construct_inits(init_estimates, init_flags, init_fltrs,             # <<<<<<<<<<<<<<
 *                                     obs0, fltr[0])
 *         l_post = -res[1]
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "pyross/inference.pyx":1917
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 *         map_x0 = self._construct_inits(init_estimates, init_flags, init_fltrs,
 *                                     obs0, fltr[0])             # <<<<<<<<<<<<<<
 *         l_post = -res[1]
 *         l_prior = np.sum(prior.logpdf(res[0]))
 */
  __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_fltr), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[6] = {__pyx_t_1, __pyx_v_init_estimates, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_10};
    __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1916, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[6] = {__pyx_t_1, __pyx_v_init_estimates, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_10};
    __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1916, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_estimates);
    __Pyx_GIVEREF(__pyx_v_init_estimates);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_init_estimates);
    __Pyx_INCREF(__pyx_v_init_flags);
    __Pyx_GIVEREF(__pyx_v_init_flags);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_init_flags);
    __Pyx_INCREF(__pyx_v_init_fltrs);
    __Pyx_GIVEREF(__pyx_v_init_fltrs);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_init_fltrs);
    __Pyx_INCREF(__pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_v_obs0);
    PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_4, __pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_4, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_map_x0 = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":1918
 *         map_x0 = self._construct_inits(init_estimates, init_flags, init_fltrs,
 *                                     obs0, fltr[0])
 *         l_post = -res[1]             # <<<<<<<<<<<<<<
 *         l_prior = np.sum(prior.logpdf(res[0]))
 *         l_like = l_post - l_prior
 */
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_res, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyNumber_Negative(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_l_post = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1919
 *                                     obs0, fltr[0])
 *         l_post = -res[1]
 *         l_prior = np.sum(prior.logpdf(res[0]))             # <<<<<<<<<<<<<<
 *         l_like = l_post - l_prior
 *         output_dict = {
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_l_prior = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1920
 *         l_post = -res[1]
 *         l_prior = np.sum(prior.logpdf(res[0]))
 *         l_like = l_post - l_prior             # <<<<<<<<<<<<<<
 *         output_dict = {
 *             'params_dict':map_params_dict, 'x0':map_x0, 'flat_params':estimates,
 */
  __pyx_t_8 = PyNumber_Subtract(__pyx_v_l_post, __pyx_v_l_prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_l_like = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1922
 *         l_like = l_post - l_prior
 *         output_dict = {
 *             'params_dict':map_params_dict, 'x0':map_x0, 'flat_params':estimates,             # <<<<<<<<<<<<<<
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *             'param_keys': keys, 'param_guess_range': param_guess_range,
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_params_dict, __pyx_v_map_params_dict) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_x0, __pyx_v_map_x0) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_flat_params, __pyx_v_estimates) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pyross/inference.pyx":1923
 *         output_dict = {
 *             'params_dict':map_params_dict, 'x0':map_x0, 'flat_params':estimates,
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,             # <<<<<<<<<<<<<<
 *             'param_keys': keys, 'param_guess_range': param_guess_range,
 *             'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pyross/inference.pyx":1924
 *             'params_dict':map_params_dict, 'x0':map_x0, 'flat_params':estimates,
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *             'param_keys': keys, 'param_guess_range': param_guess_range,             # <<<<<<<<<<<<<<
 *             'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *             'scaled_param_guesses':scaled_param_guesses,
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pyross/inference.pyx":1925
 *             'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *             'param_keys': keys, 'param_guess_range': param_guess_range,
 *             'is_scale_parameter':is_scale_parameter, 'param_length':param_length,             # <<<<<<<<<<<<<<
 *             'scaled_param_guesses':scaled_param_guesses,
 *             'init_flags': init_flags, 'init_fltrs': init_fltrs,
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pyross/inference.pyx":1926
 *             'param_keys': keys, 'param_guess_range': param_guess_range,
 *             'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *             'scaled_param_guesses':scaled_param_guesses,             # <<<<<<<<<<<<<<
 *             'init_flags': init_flags, 'init_fltrs': init_fltrs,
 *             'prior': prior,
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pyross/inference.pyx":1927
 *             'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *             'scaled_param_guesses':scaled_param_guesses,
 *             'init_flags': init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *             'prior': prior,
 *         }
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pyross/inference.pyx":1928
 *             'scaled_param_guesses':scaled_param_guesses,
 *             'init_flags': init_flags, 'init_fltrs': init_fltrs,
 *             'prior': prior,             # <<<<<<<<<<<<<<
 *         }
 *         if map_control_params_dict != {}:
 */
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  __pyx_v_output_dict = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":1930
 *             'prior': prior,
 *         }
 *         if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *             output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_map_control_params_dict, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_14) {

    /* "pyross/inference.pyx":1931
 *         }
 *         if map_control_params_dict != {}:
 *             output_dict['control_params_dict'] = map_control_params_dict             # <<<<<<<<<<<<<<
 * 
 *         return output_dict
 */
    if (unlikely(PyDict_SetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict, __pyx_v_map_control_params_dict) < 0)) __PYX_ERR(0, 1931, __pyx_L1_error)

    /* "pyross/inference.pyx":1930
 *             'prior': prior,
 *         }
 *         if map_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *             output_dict['control_params_dict'] = map_control_params_dict
 * 
 */
  }

  /* "pyross/inference.pyx":1933
 *             output_dict['control_params_dict'] = map_control_params_dict
 * 
 *         return output_dict             # <<<<<<<<<<<<<<
 * 
 *     def latent_infer_nested_sampling(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_dict);
  __pyx_r = __pyx_v_output_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1712
 *         return -logp
 * 
 *     def latent_infer(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                      contactMatrix=None, generator=None,
 *                      intervention_fun=None, tangent=False,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_param_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_param_guess);
  __Pyx_XDECREF(__pyx_v_param_stds);
  __Pyx_XDECREF(__pyx_v_param_bounds);
  __Pyx_XDECREF(__pyx_v_param_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_param_guesses);
  __Pyx_XDECREF(__pyx_v_init_prior_names);
  __Pyx_XDECREF(__pyx_v_init_guess);
  __Pyx_XDECREF(__pyx_v_init_stds);
  __Pyx_XDECREF(__pyx_v_init_bounds);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_param_length);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_cma_stds);
  __Pyx_XDECREF(__pyx_v_minimize_args);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_estimates);
  __Pyx_XDECREF(__pyx_v_param_estimates);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_init_estimates);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_map_x0);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XDECREF((PyObject *)__pyx_v_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":1935
 *         return output_dict
 * 
 *     def latent_infer_nested_sampling(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                       generator=None, intervention_fun=None, tangent=False, verbose=False, nprocesses=0,
 *                                       queue_size=None, maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_75latent_infer_nested_sampling(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_74latent_infer_nested_sampling[] = "\n        Compute the log-evidence and weighted samples for the initial conditions and all desired parameters, including control parameters,\n        for a SIR type model with partially observed classes. This function uses nested sampling as implemented in the `dynesty` Python package.\n\n        Parameters\n        ----------\n        obs: 2d numpy.array\n            The observed trajectories with reduced number of variables\n            (number of data points, (age groups * observed model classes))\n        fltr: 2d numpy.array\n            A matrix of shape (no. observed variables, no. total variables),\n            such that obs_{ti} = fltr_{ij} * X_{tj}\n        Tf: float\n            Total time of the trajectory\n        contactMatrix: callable\n            A function that returns the contact matrix at time t (input).\n        param_priors: dict\n            A dictionary for priors for the model parameters.\n            See `latent_infer` for further explanations.\n        init_priors: dict\n            A dictionary for priors for the initial conditions.\n            See `latent_infer` for further explanations.\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij}"" aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to do inference in tangent space (might be less robust but a lot faster). Default is False.\n        verbose: bool, optional\n            Set to True to see intermediate outputs from the nested sampling procedure.\n        nprocesses: int, optional\n            The number of processes used for parallel evaluation of the likelihood.\n        queue_size: int, optional\n            Size of internal queue of likelihood values, default is nprocesses if multiprocessing is used.\n        maxiter: int, optional\n            The maximum number of iterations. Default is no limit.\n        maxcall:int, optional\n            The maximum number of calls to the likelihood function. Default no limit.\n        dlogz: float, optional\n            The iteration terminates if the estimated contribution of the remaining prior volume to the total evidence\n            falls below this threshold. Default value is `1e-3 * (nlive - 1) + 0.01` if `add_live==True`, 0.01 otherwise.\n        n_effective: float, optional\n            The iteration terminates if the number of effective posterior samples reaches this values. Default is no limit.\n        add_live: bool, optional\n            Determines whether to add the remaining set of live points to the set of samples. Default is True.\n        sampler: dynesty.NestedSampler, optional\n            Continue running an instance of a nested sampler until the termination criteria are met.\n        **dynesty_args:\n            Arguments passed through to the construction of the dynesty.NestedSampler constructor. Relevant entries\n            are (this is not comprehensive, for details see the documentation of dynesty):\n\n            nlive: int, optional\n                The number of live points. Default is 500.""\n            bound: {'none', 'single', 'multi', 'balls', 'cubes'}, optional\n                Method used to approximately bound the prior using the current set of live points. Default is 'multi'.\n            sample:  {'auto', 'unif', 'rwalk', 'rstagger', 'slice', 'rslice', 'hslice', callable}, optional\n                Method used to sample uniformly within the likelihood constraint, conditioned on the provided bounds.\n\n        Returns\n        -------\n        sampler: dynesty.NestedSampler\n            The state of the sampler after termination of the nested sampling run.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_75latent_infer_nested_sampling(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_v_queue_size = 0;
  PyObject *__pyx_v_maxiter = 0;
  PyObject *__pyx_v_maxcall = 0;
  PyObject *__pyx_v_dlogz = 0;
  PyObject *__pyx_v_n_effective = 0;
  PyObject *__pyx_v_add_live = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_dynesty_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer_nested_sampling (wrapper)", 0);
  __pyx_v_dynesty_args = PyDict_New(); if (unlikely(!__pyx_v_dynesty_args)) return NULL;
  __Pyx_GOTREF(__pyx_v_dynesty_args);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_nprocesses,&__pyx_n_s_queue_size,&__pyx_n_s_maxiter,&__pyx_n_s_maxcall,&__pyx_n_s_dlogz,&__pyx_n_s_n_effective,&__pyx_n_s_add_live,&__pyx_n_s_sampler,0};
    PyObject* values[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":1936
 * 
 *     def latent_infer_nested_sampling(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None,
 *                                       generator=None, intervention_fun=None, tangent=False, verbose=False, nprocesses=0,             # <<<<<<<<<<<<<<
 *                                       queue_size=None, maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 *                                       sampler=None, **dynesty_args):
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_False);
    values[9] = ((PyObject *)Py_False);
    values[10] = ((PyObject *)__pyx_int_0);

    /* "pyross/inference.pyx":1937
 *     def latent_infer_nested_sampling(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None,
 *                                       generator=None, intervention_fun=None, tangent=False, verbose=False, nprocesses=0,
 *                                       queue_size=None, maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,             # <<<<<<<<<<<<<<
 *                                       sampler=None, **dynesty_args):
 *         """
 */
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);
    values[13] = ((PyObject *)Py_None);
    values[14] = ((PyObject *)Py_None);
    values[15] = ((PyObject *)Py_None);
    values[16] = ((PyObject *)Py_True);

    /* "pyross/inference.pyx":1938
 *                                       generator=None, intervention_fun=None, tangent=False, verbose=False, nprocesses=0,
 *                                       queue_size=None, maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 *                                       sampler=None, **dynesty_args):             # <<<<<<<<<<<<<<
 *         """
 *         Compute the log-evidence and weighted samples for the initial conditions and all desired parameters, including control parameters,
 */
    values[17] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling", 0, 5, 18, 1); __PYX_ERR(0, 1935, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling", 0, 5, 18, 2); __PYX_ERR(0, 1935, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling", 0, 5, 18, 3); __PYX_ERR(0, 1935, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling", 0, 5, 18, 4); __PYX_ERR(0, 1935, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_size);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxiter);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxcall);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dlogz);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_effective);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_add_live);
          if (value) { values[16] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[17] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_dynesty_args, values, pos_args, "latent_infer_nested_sampling") < 0)) __PYX_ERR(0, 1935, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = ((PyArrayObject *)values[0]);
    __pyx_v_fltr = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
    __pyx_v_tangent = values[8];
    __pyx_v_verbose = values[9];
    __pyx_v_nprocesses = values[10];
    __pyx_v_queue_size = values[11];
    __pyx_v_maxiter = values[12];
    __pyx_v_maxcall = values[13];
    __pyx_v_dlogz = values[14];
    __pyx_v_n_effective = values[15];
    __pyx_v_add_live = values[16];
    __pyx_v_sampler = values[17];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling", 0, 5, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1935, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_dynesty_args); __pyx_v_dynesty_args = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_nested_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 1935, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 1935, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_74latent_infer_nested_sampling(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_nprocesses, __pyx_v_queue_size, __pyx_v_maxiter, __pyx_v_maxcall, __pyx_v_dlogz, __pyx_v_n_effective, __pyx_v_add_live, __pyx_v_sampler, __pyx_v_dynesty_args);

  /* "pyross/inference.pyx":1935
 *         return output_dict
 * 
 *     def latent_infer_nested_sampling(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                       generator=None, intervention_fun=None, tangent=False, verbose=False, nprocesses=0,
 *                                       queue_size=None, maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dynesty_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_74latent_infer_nested_sampling(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_nprocesses, PyObject *__pyx_v_queue_size, PyObject *__pyx_v_maxiter, PyObject *__pyx_v_maxcall, PyObject *__pyx_v_dlogz, PyObject *__pyx_v_n_effective, PyObject *__pyx_v_add_live, PyObject *__pyx_v_sampler, PyObject *__pyx_v_dynesty_args) {
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_param_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_param_guess = NULL;
  PyObject *__pyx_v_param_stds = NULL;
  PyObject *__pyx_v_param_bounds = NULL;
  PyObject *__pyx_v_param_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_param_guesses = NULL;
  PyObject *__pyx_v_init_prior_names = NULL;
  PyObject *__pyx_v_init_guess = NULL;
  PyObject *__pyx_v_init_stds = NULL;
  PyObject *__pyx_v_init_bounds = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_param_length = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_prior = NULL;
  Py_ssize_t __pyx_v_ndim;
  PyObject *__pyx_v_prior_transform_args = NULL;
  PyObject *__pyx_v_loglike_args = NULL;
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  __Pyx_RefNannySetupContext("latent_infer_nested_sampling", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_obs);
  __Pyx_INCREF((PyObject *)__pyx_v_fltr);
  __Pyx_INCREF(__pyx_v_nprocesses);
  __Pyx_INCREF(__pyx_v_queue_size);
  __Pyx_INCREF(__pyx_v_sampler);

  /* "pyross/inference.pyx":2013
 *         """
 * 
 *         if dynesty is None:             # <<<<<<<<<<<<<<
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dynesty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":2014
 * 
 *         if dynesty is None:
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses == 0:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2014, __pyx_L1_error)

    /* "pyross/inference.pyx":2013
 *         """
 * 
 *         if dynesty is None:             # <<<<<<<<<<<<<<
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 */
  }

  /* "pyross/inference.pyx":2016
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_nprocesses, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":2017
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2017, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":2019
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()             # <<<<<<<<<<<<<<
 *             else:
 *                 nprocesses = 1
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2017
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":2021
 *                 nprocesses = pathos_mp.cpu_count()
 *             else:
 *                 nprocesses = 1             # <<<<<<<<<<<<<<
 * 
 *         if queue_size is None:
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_int_1);
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":2016
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  }

  /* "pyross/inference.pyx":2023
 *                 nprocesses = 1
 * 
 *         if queue_size is None:             # <<<<<<<<<<<<<<
 *             queue_size = nprocesses
 * 
 */
  __pyx_t_3 = (__pyx_v_queue_size == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":2024
 * 
 *         if queue_size is None:
 *             queue_size = nprocesses             # <<<<<<<<<<<<<<
 * 
 *         # Sanity checks of the intputs
 */
    __Pyx_INCREF(__pyx_v_nprocesses);
    __Pyx_DECREF_SET(__pyx_v_queue_size, __pyx_v_nprocesses);

    /* "pyross/inference.pyx":2023
 *                 nprocesses = 1
 * 
 *         if queue_size is None:             # <<<<<<<<<<<<<<
 *             queue_size = nprocesses
 * 
 */
  }

  /* "pyross/inference.pyx":2027
 * 
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2027, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2027, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2030
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, ((PyObject *)__pyx_v_fltr));
    __Pyx_INCREF(((PyObject *)__pyx_v_obs));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, ((PyObject *)__pyx_v_obs));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2030, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) __PYX_ERR(0, 2030, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2030, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2030, __pyx_L1_error)
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2030, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_fltr, ((PyArrayObject *)__pyx_t_5));
  __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_v_obs0 = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":2035
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 * 
 *         # Read in initial conditions priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_check_length, __pyx_t_5) < 0) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2033, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_13);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_7,&__pyx_t_4,&__pyx_t_1,&__pyx_t_8,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2033, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_7,&__pyx_t_4,&__pyx_t_1,&__pyx_t_8,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13};
    __pyx_t_14 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_14)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_9(__pyx_t_14); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_14), 8) < 0) __PYX_ERR(0, 2033, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2033, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }

  /* "pyross/inference.pyx":2033
 * 
 *         # Read in parameter priors
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \             # <<<<<<<<<<<<<<
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_param_prior_names = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_keys = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_param_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_param_stds = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_param_bounds = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_param_guess_range = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_12;
  __pyx_t_12 = 0;
  __pyx_v_scaled_param_guesses = __pyx_t_13;
  __pyx_t_13 = 0;

  /* "pyross/inference.pyx":2039
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 * 
 *         # Concatenate the flattend parameter guess with init guess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pyross); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_utils); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_15 = PyObject_Length(__pyx_v_obs0); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2039, __pyx_L1_error)
  __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_13)) {
    PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_init_priors, __pyx_t_12, __pyx_t_11};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
    PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_init_priors, __pyx_t_12, __pyx_t_11};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_10) {
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_t_11);
    __pyx_t_12 = 0;
    __pyx_t_11 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2038, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_13,&__pyx_t_8,&__pyx_t_11,&__pyx_t_12,&__pyx_t_10,&__pyx_t_1};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2038, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_13,&__pyx_t_8,&__pyx_t_11,&__pyx_t_12,&__pyx_t_10,&__pyx_t_1};
    __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_9(__pyx_t_4); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 6) < 0) __PYX_ERR(0, 2038, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2038, __pyx_L1_error)
    __pyx_L12_unpacking_done:;
  }

  /* "pyross/inference.pyx":2038
 * 
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 * 
 */
  __pyx_v_init_prior_names = __pyx_t_13;
  __pyx_t_13 = 0;
  __pyx_v_init_guess = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_init_stds = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_init_bounds = __pyx_t_12;
  __pyx_t_12 = 0;
  __pyx_v_init_flags = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_init_fltrs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2042
 * 
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]             # <<<<<<<<<<<<<<
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_param_guess, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_param_length = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2043
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyList_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_param_guess);
  __Pyx_GIVEREF(__pyx_v_param_guess);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_v_param_guess);
  __Pyx_INCREF(__pyx_v_init_guess);
  __Pyx_GIVEREF(__pyx_v_init_guess);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_v_init_guess);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2044
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_param_stds);
  __Pyx_GIVEREF(__pyx_v_param_stds);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_param_stds);
  __Pyx_INCREF(__pyx_v_init_stds);
  __Pyx_GIVEREF(__pyx_v_init_stds);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_init_stds);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_12 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_5, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2045
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyList_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_param_bounds);
  __Pyx_GIVEREF(__pyx_v_param_bounds);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_v_param_bounds);
  __Pyx_INCREF(__pyx_v_init_bounds);
  __Pyx_GIVEREF(__pyx_v_init_bounds);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_v_init_bounds);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 2045, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_5, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2047
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         ndim = len(guess)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyNumber_Add(__pyx_v_param_prior_names, __pyx_v_init_prior_names); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_11, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_11, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_6, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_6, __pyx_v_stds);
    __pyx_t_11 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_prior = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2049
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 * 
 *         ndim = len(guess)             # <<<<<<<<<<<<<<
 * 
 *         prior_transform_args = {'prior':prior}
 */
  __pyx_t_15 = PyObject_Length(__pyx_v_guess); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2049, __pyx_L1_error)
  __pyx_v_ndim = __pyx_t_15;

  /* "pyross/inference.pyx":2051
 *         ndim = len(guess)
 * 
 *         prior_transform_args = {'prior':prior}             # <<<<<<<<<<<<<<
 *         loglike_args = {'generator':generator, 'intervention_fun':intervention_fun, 'param_keys':keys,
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 2051, __pyx_L1_error)
  __pyx_v_prior_transform_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2052
 * 
 *         prior_transform_args = {'prior':prior}
 *         loglike_args = {'generator':generator, 'intervention_fun':intervention_fun, 'param_keys':keys,             # <<<<<<<<<<<<<<
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)

  /* "pyross/inference.pyx":2053
 *         prior_transform_args = {'prior':prior}
 *         loglike_args = {'generator':generator, 'intervention_fun':intervention_fun, 'param_keys':keys,
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)

  /* "pyross/inference.pyx":2054
 *         loglike_args = {'generator':generator, 'intervention_fun':intervention_fun, 'param_keys':keys,
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,             # <<<<<<<<<<<<<<
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                         'tangent':tangent, 'bounds':bounds}
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs, ((PyObject *)__pyx_v_obs)) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)

  /* "pyross/inference.pyx":2055
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *                         'tangent':tangent, 'bounds':bounds}
 * 
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fltr, ((PyObject *)__pyx_v_fltr)) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs0, __pyx_v_obs0) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)

  /* "pyross/inference.pyx":2056
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                         'tangent':tangent, 'bounds':bounds}             # <<<<<<<<<<<<<<
 * 
 *         if sampler is None:
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_bounds, __pyx_v_bounds) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  __pyx_v_loglike_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2058
 *                         'tangent':tangent, 'bounds':bounds}
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 */
  __pyx_t_2 = (__pyx_v_sampler == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":2059
 * 
 *         if sampler is None:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2059, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2059, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":2060
 *         if sampler is None:
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2060, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2060, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2060, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_pool = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2061
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dynesty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_NestedSampler); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglikelihood_latent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nested_sampling_prior_transform); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
      __pyx_t_1 = 0;
      __pyx_t_10 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_ndim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ndim, __pyx_t_5) < 0) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pyross/inference.pyx":2062
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,             # <<<<<<<<<<<<<<
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 *             else:
 */
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_logl_kwargs, __pyx_v_loglike_args) < 0) __PYX_ERR(0, 2061, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ptform_kwargs, __pyx_v_prior_transform_args) < 0) __PYX_ERR(0, 2061, __pyx_L1_error)

      /* "pyross/inference.pyx":2063
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)             # <<<<<<<<<<<<<<
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 */
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_pool, __pyx_v_pool) < 0) __PYX_ERR(0, 2061, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_queue_size, __pyx_v_queue_size) < 0) __PYX_ERR(0, 2061, __pyx_L1_error)
      __pyx_t_10 = __pyx_t_1;
      __pyx_t_1 = 0;
      if (__Pyx_MergeKeywords(__pyx_t_10, __pyx_v_dynesty_args) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)

      /* "pyross/inference.pyx":2061
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2061, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2059
 * 
 *         if sampler is None:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 */
      goto __pyx_L14;
    }

    /* "pyross/inference.pyx":2065
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 **dynesty_args)
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dynesty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_NestedSampler); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglikelihood_latent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nested_sampling_prior_transform); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
      __pyx_t_1 = 0;
      __pyx_t_11 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_ndim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ndim, __pyx_t_5) < 0) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pyross/inference.pyx":2066
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,             # <<<<<<<<<<<<<<
 *                                                 **dynesty_args)
 *         else:
 */
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_logl_kwargs, __pyx_v_loglike_args) < 0) __PYX_ERR(0, 2065, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ptform_kwargs, __pyx_v_prior_transform_args) < 0) __PYX_ERR(0, 2065, __pyx_L1_error)
      __pyx_t_11 = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2067
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 **dynesty_args)             # <<<<<<<<<<<<<<
 *         else:
 *             if nprocesses > 1:
 */
      if (__Pyx_MergeKeywords(__pyx_t_11, __pyx_v_dynesty_args) < 0) __PYX_ERR(0, 2067, __pyx_L1_error)

      /* "pyross/inference.pyx":2065
 *                                                 pool=pool, queue_size=queue_size, **dynesty_args)
 *             else:
 *                 sampler = dynesty.NestedSampler(self._loglikelihood_latent, self._nested_sampling_prior_transform, ndim=ndim,             # <<<<<<<<<<<<<<
 *                                                 logl_kwargs=loglike_args, ptform_kwargs=prior_transform_args,
 *                                                 **dynesty_args)
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L14:;

    /* "pyross/inference.pyx":2058
 *                         'tangent':tangent, 'bounds':bounds}
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             if nprocesses > 1:
 *                 pool = pathos_mp.ProcessingPool(nprocesses)
 */
    goto __pyx_L13;
  }

  /* "pyross/inference.pyx":2069
 *                                                 **dynesty_args)
 *         else:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 */
  /*else*/ {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":2071
 *             if nprocesses > 1:
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, __pyx_t_1) < 0) __PYX_ERR(0, 2071, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2072
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler.M = sampler.pool.map             # <<<<<<<<<<<<<<
 *             elif sampler.pool is not None:
 *                 sampler.pool = None
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2072, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_map); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2072, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_M, __pyx_t_12) < 0) __PYX_ERR(0, 2072, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "pyross/inference.pyx":2069
 *                                                 **dynesty_args)
 *         else:
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 */
      goto __pyx_L15;
    }

    /* "pyross/inference.pyx":2073
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 sampler.pool = None
 *                 sampler.M = map
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_3 = (__pyx_t_12 != Py_None);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "pyross/inference.pyx":2074
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:
 *                 sampler.pool = None             # <<<<<<<<<<<<<<
 *                 sampler.M = map
 * 
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, Py_None) < 0) __PYX_ERR(0, 2074, __pyx_L1_error)

      /* "pyross/inference.pyx":2075
 *             elif sampler.pool is not None:
 *                 sampler.pool = None
 *                 sampler.M = map             # <<<<<<<<<<<<<<
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_M, __pyx_builtin_map) < 0) __PYX_ERR(0, 2075, __pyx_L1_error)

      /* "pyross/inference.pyx":2073
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler.M = sampler.pool.map
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 sampler.pool = None
 *                 sampler.M = map
 */
    }
    __pyx_L15:;
  }
  __pyx_L13:;

  /* "pyross/inference.pyx":2077
 *                 sampler.M = map
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,             # <<<<<<<<<<<<<<
 *                            add_live=add_live, print_progress=verbose)
 * 
 */
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_run_nested); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_maxiter, __pyx_v_maxiter) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_maxcall, __pyx_v_maxcall) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dlogz, __pyx_v_dlogz) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_n_effective, __pyx_v_n_effective) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)

  /* "pyross/inference.pyx":2078
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,
 *                            add_live=add_live, print_progress=verbose)             # <<<<<<<<<<<<<<
 * 
 *         if sampler.pool is not None:
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_add_live, __pyx_v_add_live) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_print_progress, __pyx_v_verbose) < 0) __PYX_ERR(0, 2077, __pyx_L1_error)

  /* "pyross/inference.pyx":2077
 *                 sampler.M = map
 * 
 *         sampler.run_nested(maxiter=maxiter, maxcall=maxcall, dlogz=dlogz, n_effective=n_effective,             # <<<<<<<<<<<<<<
 *                            add_live=add_live, print_progress=verbose)
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pyross/inference.pyx":2080
 *                            add_live=add_live, print_progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_2 = (__pyx_t_11 != Py_None);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":2081
 * 
 *         if sampler.pool is not None:
 *             sampler.pool.close()             # <<<<<<<<<<<<<<
 *             sampler.pool.join()
 *             sampler.pool.clear()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_close); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_11 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2082
 *         if sampler.pool is not None:
 *             sampler.pool.close()
 *             sampler.pool.join()             # <<<<<<<<<<<<<<
 *             sampler.pool.clear()
 * 
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2083
 *             sampler.pool.close()
 *             sampler.pool.join()
 *             sampler.pool.clear()             # <<<<<<<<<<<<<<
 * 
 *         return sampler
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_clear); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_11 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2080
 *                            add_live=add_live, print_progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  }

  /* "pyross/inference.pyx":2085
 *             sampler.pool.clear()
 * 
 *         return sampler             # <<<<<<<<<<<<<<
 * 
 *     def latent_infer_nested_sampling_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sampler);
  __pyx_r = __pyx_v_sampler;
  goto __pyx_L0;

  /* "pyross/inference.pyx":1935
 *         return output_dict
 * 
 *     def latent_infer_nested_sampling(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                       generator=None, intervention_fun=None, tangent=False, verbose=False, nprocesses=0,
 *                                       queue_size=None, maxiter=None, maxcall=None, dlogz=None, n_effective=None, add_live=True,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_nested_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_param_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_param_guess);
  __Pyx_XDECREF(__pyx_v_param_stds);
  __Pyx_XDECREF(__pyx_v_param_bounds);
  __Pyx_XDECREF(__pyx_v_param_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_param_guesses);
  __Pyx_XDECREF(__pyx_v_init_prior_names);
  __Pyx_XDECREF(__pyx_v_init_guess);
  __Pyx_XDECREF(__pyx_v_init_stds);
  __Pyx_XDECREF(__pyx_v_init_bounds);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_param_length);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_prior_transform_args);
  __Pyx_XDECREF(__pyx_v_loglike_args);
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XDECREF((PyObject *)__pyx_v_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_fltr);
  __Pyx_XDECREF(__pyx_v_nprocesses);
  __Pyx_XDECREF(__pyx_v_queue_size);
  __Pyx_XDECREF(__pyx_v_sampler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2087
 *         return sampler
 * 
 *     def latent_infer_nested_sampling_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                                      generator=None, intervention_fun=None, **catchall_kwargs):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_77latent_infer_nested_sampling_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_76latent_infer_nested_sampling_process_result[] = "\n        Take the sampler generated by `pyross.inference.latent_infer_nested_sampling` and produce output dictionaries for\n        further use in the pyross framework. See there for additional description of parameters.\n\n        Parameters\n        ----------\n        sampler: dynesty.NestedSampler\n            Output of `pyross.inference.latent_infer_nested_sampling`.\n        obs: 2d numpy.array\n        fltr: 2d numpy.array\n        param_priors: dict\n        init_priors: dict\n        contactMatrix: callable, optional\n        generator: pyross.contactMatrix, optional\n        intervention_fun: callable, optional\n        **catchall_kwargs: dict\n            Catches further provided arguments and ignores them.\n\n        Returns\n        -------\n        result: dynesty.Result\n            The result of the nested sampling iteration. Relevant entries include:\n\n            result.logz: list\n                The progression of log-evidence estimates, use result.logz[-1] for the final estimate.\n        output_samples: list\n            The processed weighted posterior samples.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_77latent_infer_nested_sampling_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer_nested_sampling_process_result (wrapper)", 0);
  __pyx_v_catchall_kwargs = PyDict_New(); if (unlikely(!__pyx_v_catchall_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_catchall_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2088
 * 
 *     def latent_infer_nested_sampling_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,
 *                                                      generator=None, intervention_fun=None, **catchall_kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Take the sampler generated by `pyross.inference.latent_infer_nested_sampling` and produce output dictionaries for
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling_process_result", 0, 5, 8, 1); __PYX_ERR(0, 2087, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling_process_result", 0, 5, 8, 2); __PYX_ERR(0, 2087, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling_process_result", 0, 5, 8, 3); __PYX_ERR(0, 2087, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling_process_result", 0, 5, 8, 4); __PYX_ERR(0, 2087, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_catchall_kwargs, values, pos_args, "latent_infer_nested_sampling_process_result") < 0)) __PYX_ERR(0, 2087, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sampler = values[0];
    __pyx_v_obs = values[1];
    __pyx_v_fltr = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer_nested_sampling_process_result", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2087, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_catchall_kwargs); __pyx_v_catchall_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_nested_sampling_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_76latent_infer_nested_sampling_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_obs, __pyx_v_fltr, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_catchall_kwargs);

  /* "pyross/inference.pyx":2087
 *         return sampler
 * 
 *     def latent_infer_nested_sampling_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                                      generator=None, intervention_fun=None, **catchall_kwargs):
 *         """
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_catchall_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_76latent_infer_nested_sampling_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs) {
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_param_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_param_guess = NULL;
  PyObject *__pyx_v_param_stds = NULL;
  PyObject *__pyx_v_param_bounds = NULL;
  PyObject *__pyx_v_param_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_param_guesses = NULL;
  PyObject *__pyx_v_init_prior_names = NULL;
  PyObject *__pyx_v_init_guess = NULL;
  PyObject *__pyx_v_init_stds = NULL;
  PyObject *__pyx_v_init_bounds = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_param_length = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_output_samples = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_v_weight = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_param_sample = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_init_sample = NULL;
  PyObject *__pyx_v_sample_params_dict = NULL;
  PyObject *__pyx_v_sample_control_params_dict = NULL;
  PyObject *__pyx_v_sample_x0 = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_v_output_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  __Pyx_RefNannySetupContext("latent_infer_nested_sampling_process_result", 0);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);

  /* "pyross/inference.pyx":2118
 *         """
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2118, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2118, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2121
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_fltr);
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2121, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 2121, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2121, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_fltr, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_obs0 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2126
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 * 
 *         # Read in initial conditions priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_check_length, __pyx_t_2) < 0) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2124, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2124, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
    __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_12)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_12); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_12), 8) < 0) __PYX_ERR(0, 2124, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2124, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }

  /* "pyross/inference.pyx":2124
 * 
 *         # Read in parameter priors
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \             # <<<<<<<<<<<<<<
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_param_prior_names = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_keys = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_param_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_param_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_param_bounds = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_param_guess_range = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_scaled_param_guesses = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "pyross/inference.pyx":2130
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 * 
 *         # Concatenate the flattend parameter guess with init guess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pyross); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_utils); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_13 = PyObject_Length(__pyx_v_obs0); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2130, __pyx_L1_error)
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2130, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2130, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_t_9);
    __pyx_t_10 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2129, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2129, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
    __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_3); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 6) < 0) __PYX_ERR(0, 2129, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2129, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }

  /* "pyross/inference.pyx":2129
 * 
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 * 
 */
  __pyx_v_init_prior_names = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_init_guess = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_init_stds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_init_bounds = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_init_flags = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_init_fltrs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2133
 * 
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]             # <<<<<<<<<<<<<<
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_param_guess, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_param_length = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2134
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_guess);
  __Pyx_GIVEREF(__pyx_v_param_guess);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_guess);
  __Pyx_INCREF(__pyx_v_init_guess);
  __Pyx_GIVEREF(__pyx_v_init_guess);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_guess);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2135
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_stds);
  __Pyx_GIVEREF(__pyx_v_param_stds);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_param_stds);
  __Pyx_INCREF(__pyx_v_init_stds);
  __Pyx_GIVEREF(__pyx_v_init_stds);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_init_stds);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2136
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_bounds);
  __Pyx_GIVEREF(__pyx_v_param_bounds);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_bounds);
  __Pyx_INCREF(__pyx_v_init_bounds);
  __Pyx_GIVEREF(__pyx_v_init_bounds);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_bounds);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 2136, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2138
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         result = sampler.results
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Add(__pyx_v_param_prior_names, __pyx_v_init_prior_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2138, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2138, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_prior = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2140
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 * 
 *         result = sampler.results             # <<<<<<<<<<<<<<
 *         output_samples = []
 *         for i in range(len(result.samples)):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2141
 * 
 *         result = sampler.results
 *         output_samples = []             # <<<<<<<<<<<<<<
 *         for i in range(len(result.samples)):
 *             sample = result.samples[i]
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_output_samples = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2142
 *         result = sampler.results
 *         output_samples = []
 *         for i in range(len(result.samples)):             # <<<<<<<<<<<<<<
 *             sample = result.samples[i]
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_14 = __pyx_t_13;
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
    __pyx_v_i = __pyx_t_15;

    /* "pyross/inference.pyx":2143
 *         output_samples = []
 *         for i in range(len(result.samples)):
 *             sample = result.samples[i]             # <<<<<<<<<<<<<<
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])
 *             l_like = result.logl[i]
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":2144
 *         for i in range(len(result.samples)):
 *             sample = result.samples[i]
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])             # <<<<<<<<<<<<<<
 *             l_like = result.logl[i]
 *             # Get the parameters (in their original structure) from the flattened parameter vector.
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_exp); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logwt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_17 = (__pyx_t_16 - 1);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_17, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_8 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_weight, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":2145
 *             sample = result.samples[i]
 *             weight = np.exp(result.logwt[i] - result.logz[len(result.logz)-1])
 *             l_like = result.logl[i]             # <<<<<<<<<<<<<<
 *             # Get the parameters (in their original structure) from the flattened parameter vector.
 *             param_sample = sample[:param_length]
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_logl); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_8, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_like, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2147
 *             l_like = result.logl[i]
 *             # Get the parameters (in their original structure) from the flattened parameter vector.
 *             param_sample = sample[:param_length]             # <<<<<<<<<<<<<<
 *             orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 *                                                             is_scale_parameter, scaled_param_guesses)
 */
    __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_sample, 0, 0, NULL, &__pyx_v_param_length, NULL, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_param_sample, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2148
 *             # Get the parameters (in their original structure) from the flattened parameter vector.
 *             param_sample = sample[:param_length]
 *             orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,             # <<<<<<<<<<<<<<
 *                                                             is_scale_parameter, scaled_param_guesses)
 *             init_sample = sample[param_length:]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyross); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_utils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2149
 *             param_sample = sample[:param_length]
 *             orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 *                                                             is_scale_parameter, scaled_param_guesses)             # <<<<<<<<<<<<<<
 *             init_sample = sample[param_length:]
 * 
 */
    __pyx_t_1 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_param_sample, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_10);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_param_sample, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_10);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_param_sample);
      __Pyx_GIVEREF(__pyx_v_param_sample);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_param_sample);
      __Pyx_INCREF(__pyx_v_param_guess_range);
      __Pyx_GIVEREF(__pyx_v_param_guess_range);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_param_guess_range);
      __Pyx_INCREF(__pyx_v_is_scale_parameter);
      __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
      __Pyx_INCREF(__pyx_v_scaled_param_guesses);
      __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
      PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_4, __pyx_v_scaled_param_guesses);
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_orig_params, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2150
 *             orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 *                                                             is_scale_parameter, scaled_param_guesses)
 *             init_sample = sample[param_length:]             # <<<<<<<<<<<<<<
 * 
 *             sample_params_dict, sample_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 */
    __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_sample, 0, 0, &__pyx_v_param_length, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_init_sample, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2152
 *             init_sample = sample[param_length:]
 * 
 *             sample_params_dict, sample_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *             self.set_params(sample_params_dict)
 * 
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_keys);
    __Pyx_GIVEREF(__pyx_v_keys);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_keys);
    __Pyx_INCREF(__pyx_v_orig_params);
    __Pyx_GIVEREF(__pyx_v_orig_params);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_orig_params);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 2152, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2152, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_10), 2) < 0) __PYX_ERR(0, 2152, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L12_unpacking_done;
      __pyx_L11_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2152, __pyx_L1_error)
      __pyx_L12_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_sample_params_dict, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sample_control_params_dict, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":2153
 * 
 *             sample_params_dict, sample_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 *             self.set_params(sample_params_dict)             # <<<<<<<<<<<<<<
 * 
 *             if generator is not None:
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_v_sample_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_sample_params_dict);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2155
 *             self.set_params(sample_params_dict)
 * 
 *             if generator is not None:             # <<<<<<<<<<<<<<
 *                 if intervention_fun is None:
 *                     self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 */
    __pyx_t_18 = (__pyx_v_generator != Py_None);
    __pyx_t_19 = (__pyx_t_18 != 0);
    if (__pyx_t_19) {

      /* "pyross/inference.pyx":2156
 * 
 *             if generator is not None:
 *                 if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                     self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 *                 else:
 */
      __pyx_t_19 = (__pyx_v_intervention_fun == Py_None);
      __pyx_t_18 = (__pyx_t_19 != 0);
      if (__pyx_t_18) {

        /* "pyross/inference.pyx":2157
 *             if generator is not None:
 *                 if intervention_fun is None:
 *                     self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **sample_control_params_dict)
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(__pyx_v_sample_control_params_dict == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 2157, __pyx_L1_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_sample_control_params_dict))) {
          __pyx_t_8 = PyDict_Copy(__pyx_v_sample_control_params_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
        } else {
          __pyx_t_8 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_sample_control_params_dict, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
        }
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_v_self->contactMatrix);
        __Pyx_DECREF(__pyx_v_self->contactMatrix);
        __pyx_v_self->contactMatrix = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "pyross/inference.pyx":2156
 * 
 *             if generator is not None:
 *                 if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                     self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 *                 else:
 */
        goto __pyx_L14;
      }

      /* "pyross/inference.pyx":2159
 *                     self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 *                 else:
 *                     self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **sample_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *             sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])
 */
      /*else*/ {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_intervention_fun);
        __Pyx_GIVEREF(__pyx_v_intervention_fun);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_intervention_fun);
        if (unlikely(__pyx_v_sample_control_params_dict == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 2159, __pyx_L1_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_sample_control_params_dict))) {
          __pyx_t_1 = PyDict_Copy(__pyx_v_sample_control_params_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2159, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_sample_control_params_dict, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2159, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GIVEREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_v_self->contactMatrix);
        __Pyx_DECREF(__pyx_v_self->contactMatrix);
        __pyx_v_self->contactMatrix = __pyx_t_10;
        __pyx_t_10 = 0;
      }
      __pyx_L14:;

      /* "pyross/inference.pyx":2155
 *             self.set_params(sample_params_dict)
 * 
 *             if generator is not None:             # <<<<<<<<<<<<<<
 *                 if intervention_fun is None:
 *                     self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 */
    }

    /* "pyross/inference.pyx":2161
 *                     self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **sample_control_params_dict)
 * 
 *             sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])             # <<<<<<<<<<<<<<
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_prior + l_like
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_fltr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[6] = {__pyx_t_2, __pyx_v_init_sample, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_8};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2161, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[6] = {__pyx_t_2, __pyx_v_init_sample, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_8};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2161, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2161, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_init_sample);
      __Pyx_GIVEREF(__pyx_v_init_sample);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_v_init_sample);
      __Pyx_INCREF(__pyx_v_init_flags);
      __Pyx_GIVEREF(__pyx_v_init_flags);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_v_init_flags);
      __Pyx_INCREF(__pyx_v_init_fltrs);
      __Pyx_GIVEREF(__pyx_v_init_fltrs);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_4, __pyx_v_init_fltrs);
      __Pyx_INCREF(__pyx_v_obs0);
      __Pyx_GIVEREF(__pyx_v_obs0);
      PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_4, __pyx_v_obs0);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_4, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2161, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sample_x0, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2162
 * 
 *             sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])
 *             l_prior = np.sum(prior.logpdf(sample))             # <<<<<<<<<<<<<<
 *             l_post = l_prior + l_like
 *             output_dict = {
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_v_sample) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_sample);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_10 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_prior, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2163
 *             sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_prior + l_like             # <<<<<<<<<<<<<<
 *             output_dict = {
 *                 'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,
 */
    __pyx_t_10 = PyNumber_Add(__pyx_v_l_prior, __pyx_v_l_like); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2165
 *             l_post = l_prior + l_like
 *             output_dict = {
 *                 'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,             # <<<<<<<<<<<<<<
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                 'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 */
    __pyx_t_10 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_params_dict, __pyx_v_sample_params_dict) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_x0, __pyx_v_sample_x0) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_flat_params, __pyx_v_sample) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)

    /* "pyross/inference.pyx":2166
 *             output_dict = {
 *                 'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,             # <<<<<<<<<<<<<<
 *                 'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 *                 'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 */
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)

    /* "pyross/inference.pyx":2167
 *                 'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                 'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,             # <<<<<<<<<<<<<<
 *                 'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *                 'scaled_param_guesses':scaled_param_guesses,
 */
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_weight, __pyx_v_weight) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)

    /* "pyross/inference.pyx":2168
 *                 'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                 'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 *                 'is_scale_parameter':is_scale_parameter, 'param_length':param_length,             # <<<<<<<<<<<<<<
 *                 'scaled_param_guesses':scaled_param_guesses,
 *                 'init_flags': init_flags, 'init_fltrs': init_fltrs,
 */
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)

    /* "pyross/inference.pyx":2169
 *                 'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 *                 'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *                 'scaled_param_guesses':scaled_param_guesses,             # <<<<<<<<<<<<<<
 *                 'init_flags': init_flags, 'init_fltrs': init_fltrs,
 *                 'prior':prior
 */
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)

    /* "pyross/inference.pyx":2170
 *                 'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *                 'scaled_param_guesses':scaled_param_guesses,
 *                 'init_flags': init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *                 'prior':prior
 *             }
 */
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)

    /* "pyross/inference.pyx":2171
 *                 'scaled_param_guesses':scaled_param_guesses,
 *                 'init_flags': init_flags, 'init_fltrs': init_fltrs,
 *                 'prior':prior             # <<<<<<<<<<<<<<
 *             }
 * 
 */
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 2165, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_output_dict, ((PyObject*)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2174
 *             }
 * 
 *             if sample_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                 output_dict['control_params_dict'] = sample_control_params_dict
 * 
 */
    __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyObject_RichCompare(__pyx_v_sample_control_params_dict, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2174, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 2174, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_18) {

      /* "pyross/inference.pyx":2175
 * 
 *             if sample_control_params_dict != {}:
 *                 output_dict['control_params_dict'] = sample_control_params_dict             # <<<<<<<<<<<<<<
 * 
 *             output_samples.append(output_dict)
 */
      if (unlikely(PyDict_SetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict, __pyx_v_sample_control_params_dict) < 0)) __PYX_ERR(0, 2175, __pyx_L1_error)

      /* "pyross/inference.pyx":2174
 *             }
 * 
 *             if sample_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                 output_dict['control_params_dict'] = sample_control_params_dict
 * 
 */
    }

    /* "pyross/inference.pyx":2177
 *                 output_dict['control_params_dict'] = sample_control_params_dict
 * 
 *             output_samples.append(output_dict)             # <<<<<<<<<<<<<<
 * 
 *         return result, output_samples
 */
    __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_output_samples, __pyx_v_output_dict); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 2177, __pyx_L1_error)
  }

  /* "pyross/inference.pyx":2179
 *             output_samples.append(output_dict)
 * 
 *         return result, output_samples             # <<<<<<<<<<<<<<
 * 
 *     def latent_infer_mcmc(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None, generator=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_v_result);
  __Pyx_GIVEREF(__pyx_v_result);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_result);
  __Pyx_INCREF(__pyx_v_output_samples);
  __Pyx_GIVEREF(__pyx_v_output_samples);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_output_samples);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2087
 *         return sampler
 * 
 *     def latent_infer_nested_sampling_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                                      generator=None, intervention_fun=None, **catchall_kwargs):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_nested_sampling_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_param_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_param_guess);
  __Pyx_XDECREF(__pyx_v_param_stds);
  __Pyx_XDECREF(__pyx_v_param_bounds);
  __Pyx_XDECREF(__pyx_v_param_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_param_guesses);
  __Pyx_XDECREF(__pyx_v_init_prior_names);
  __Pyx_XDECREF(__pyx_v_init_guess);
  __Pyx_XDECREF(__pyx_v_init_stds);
  __Pyx_XDECREF(__pyx_v_init_bounds);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_param_length);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XDECREF(__pyx_v_weight);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_param_sample);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_init_sample);
  __Pyx_XDECREF(__pyx_v_sample_params_dict);
  __Pyx_XDECREF(__pyx_v_sample_control_params_dict);
  __Pyx_XDECREF(__pyx_v_sample_x0);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_XDECREF(__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2181
 *         return result, output_samples
 * 
 *     def latent_infer_mcmc(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                           intervention_fun=None, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,
 *                           nsamples=1000, nprocesses=0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_79latent_infer_mcmc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_78latent_infer_mcmc[] = " Sample the posterior distribution of the initial conditions and all desired parameters, including control parameters, using\n        ensemble MCMC. This requires the optional dependency `emcee`.\n\n        Parameters\n        ----------\n        obs: 2d numpy.array\n            The observed trajectories with reduced number of variables\n            (number of data points, (age groups * observed model classes))\n        fltr: 2d numpy.array\n            A matrix of shape (no. observed variables, no. total variables),\n            such that obs_{ti} = fltr_{ij} * X_{tj}\n        Tf: float\n            Total time of the trajectory\n        contactMatrix: callable\n            A function that returns the contact matrix at time t (input).\n        param_priors: dict\n            A dictionary for priors for the model parameters.\n            See `latent_infer_parameters` for further explanations.\n        init_priors: dict\n            A dictionary for priors for the initial conditions.\n            See `latent_infer_parameters` for further explanations.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        verbose: bool, optional\n            Set to True to see a progress bar for the sample generation. Default is False.\n        sampler: emcee.EnsembleSampler, optional\n            Set to instance of the sampler (as returned by this function) to continue running the MCMC chains.\n            Default is None (i.e. run a new chain).\n        nwalkers:int, optional\n            The number of chains in the ensemble (should be at least 2*dim). Default is 2*dim.\n        walker_pos: np.array, optional\n            The initial position of the walkers. If not specified, the function samples random positions from the prior.\n        nsamples:int, optional\n            The number of samples per walker. Default is 1000.\n        nprocesses: int, optional\n            The number of processes used to compute the likeliho""od for the walkers, needs `pathos` for values > 1.\n            Default is the number of cpu cores if `pathos` is available, otherwise 1.\n\n        Returns\n        -------\n        sampler: emcee.EnsembleSampler\n            This function returns the state of the sampler. To look at the chain of the internal flattened parameters,\n            run `sampler.get_chain()`. Use this to judge whether the chain has sufficiently converged. Either rerun\n            `latent_infer_mcmc(..., sampler=sampler)` to continue the chain or `latent_infer_mcmc_process_result(...)`\n            to process the result.\n\n        Examples\n        --------\n        For the structure of the model input parameters, in particular `param_priors, init_priors`, see the documentation\n        of `latent_infer`. To start sampling the posterior, run for example\n\n        >>> sampler = estimator.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,\n                                                  verbose=True)\n\n        To judge the convergence of this chain, we can look at the trace plot of all the chains (for a moderate number of\n        dimensions `dim`)\n\n        >>> fig, axes = plt.subplots(dim, sharex=True)\n        >>> samples = sampler.get_chain()\n        >>> for i in range(dim):\n                ax = axes[i]\n                ax.plot(samples[:, :, i], \"k\", alpha=0.3)\n                ax.set_xlim(0, len(samples))\n        >>> axes[-1].set_xlabel(\"step number\");\n\n        For more detailed convergence metrics, see the documentation of `emcee`. To continue running this chain, we can\n        call this function again with the sampler as argument\n\n        >>> sampler = estimator.latent_infer_mcmc(obs, fltr, Tf, param_priors, init_priors, contactMatrix=contactMatrix,\n                                                  verbose=True, sampler=sampler)\n\n        This procudes 1000 additional samples in each chain. To process the results, call\n     ""   `pyross.inference.latent_infer_mcmc_process_result`.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_79latent_infer_mcmc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_nwalkers = 0;
  PyObject *__pyx_v_walker_pos = 0;
  PyObject *__pyx_v_nsamples = 0;
  PyObject *__pyx_v_nprocesses = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer_mcmc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_verbose,&__pyx_n_s_sampler,&__pyx_n_s_nwalkers,&__pyx_n_s_walker_pos,&__pyx_n_s_nsamples,&__pyx_n_s_nprocesses,0};
    PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2182
 * 
 *     def latent_infer_mcmc(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None, generator=None,
 *                           intervention_fun=None, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,             # <<<<<<<<<<<<<<
 *                           nsamples=1000, nprocesses=0):
 *         """ Sample the posterior distribution of the initial conditions and all desired parameters, including control parameters, using
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_False);
    values[9] = ((PyObject *)Py_False);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);
    values[13] = ((PyObject *)__pyx_int_1000);
    values[14] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc", 0, 5, 15, 1); __PYX_ERR(0, 2181, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc", 0, 5, 15, 2); __PYX_ERR(0, 2181, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc", 0, 5, 15, 3); __PYX_ERR(0, 2181, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc", 0, 5, 15, 4); __PYX_ERR(0, 2181, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nwalkers);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_walker_pos);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsamples);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nprocesses);
          if (value) { values[14] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "latent_infer_mcmc") < 0)) __PYX_ERR(0, 2181, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = ((PyArrayObject *)values[0]);
    __pyx_v_fltr = ((PyArrayObject *)values[1]);
    __pyx_v_Tf = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
    __pyx_v_tangent = values[8];
    __pyx_v_verbose = values[9];
    __pyx_v_sampler = values[10];
    __pyx_v_nwalkers = values[11];
    __pyx_v_walker_pos = values[12];
    __pyx_v_nsamples = values[13];
    __pyx_v_nprocesses = values[14];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc", 0, 5, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2181, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_mcmc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 2181, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 2181, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_78latent_infer_mcmc(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_verbose, __pyx_v_sampler, __pyx_v_nwalkers, __pyx_v_walker_pos, __pyx_v_nsamples, __pyx_v_nprocesses);

  /* "pyross/inference.pyx":2181
 *         return result, output_samples
 * 
 *     def latent_infer_mcmc(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                           intervention_fun=None, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,
 *                           nsamples=1000, nprocesses=0):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_78latent_infer_mcmc(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_verbose, PyObject *__pyx_v_sampler, PyObject *__pyx_v_nwalkers, PyObject *__pyx_v_walker_pos, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_nprocesses) {
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_param_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_param_guess = NULL;
  PyObject *__pyx_v_param_stds = NULL;
  PyObject *__pyx_v_param_bounds = NULL;
  PyObject *__pyx_v_param_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_param_guesses = NULL;
  PyObject *__pyx_v_init_prior_names = NULL;
  PyObject *__pyx_v_init_guess = NULL;
  PyObject *__pyx_v_init_stds = NULL;
  PyObject *__pyx_v_init_bounds = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_param_length = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_ndim = NULL;
  PyObject *__pyx_v_logpost_args = NULL;
  PyObject *__pyx_v_points = NULL;
  PyObject *__pyx_v_p0 = NULL;
  PyObject *__pyx_v_mcmc_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  Py_ssize_t __pyx_t_16;
  __Pyx_RefNannySetupContext("latent_infer_mcmc", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_obs);
  __Pyx_INCREF((PyObject *)__pyx_v_fltr);
  __Pyx_INCREF(__pyx_v_sampler);
  __Pyx_INCREF(__pyx_v_nwalkers);
  __Pyx_INCREF(__pyx_v_nprocesses);

  /* "pyross/inference.pyx":2258
 *         `pyross.inference.latent_infer_mcmc_process_result`.
 *         """
 *         if emcee is None:             # <<<<<<<<<<<<<<
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_emcee); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":2259
 *         """
 *         if emcee is None:
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses == 0:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2259, __pyx_L1_error)

    /* "pyross/inference.pyx":2258
 *         `pyross.inference.latent_infer_mcmc_process_result`.
 *         """
 *         if emcee is None:             # <<<<<<<<<<<<<<
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 */
  }

  /* "pyross/inference.pyx":2261
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_nprocesses, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2261, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":2262
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2262, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":2264
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()             # <<<<<<<<<<<<<<
 *             else:
 *                 nprocesses = 1
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2262
 * 
 *         if nprocesses == 0:
 *             if pathos_mp:             # <<<<<<<<<<<<<<
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 *                 nprocesses = pathos_mp.cpu_count()
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":2266
 *                 nprocesses = pathos_mp.cpu_count()
 *             else:
 *                 nprocesses = 1             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses > 1 and pathos_mp is None:
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_DECREF_SET(__pyx_v_nprocesses, __pyx_int_1);
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":2261
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")
 * 
 *         if nprocesses == 0:             # <<<<<<<<<<<<<<
 *             if pathos_mp:
 *                 # Optional dependecy for multiprocessing (pathos) is installed.
 */
  }

  /* "pyross/inference.pyx":2268
 *                 nprocesses = 1
 * 
 *         if nprocesses > 1 and pathos_mp is None:             # <<<<<<<<<<<<<<
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_2 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L7_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":2269
 * 
 *         if nprocesses > 1 and pathos_mp is None:
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")             # <<<<<<<<<<<<<<
 * 
 *         # Sanity checks of the intputs
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2269, __pyx_L1_error)

    /* "pyross/inference.pyx":2268
 *                 nprocesses = 1
 * 
 *         if nprocesses > 1 and pathos_mp is None:             # <<<<<<<<<<<<<<
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")
 * 
 */
  }

  /* "pyross/inference.pyx":2272
 * 
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2272, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2272, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2275
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, ((PyObject *)__pyx_v_fltr));
    __Pyx_INCREF(((PyObject *)__pyx_v_obs));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, ((PyObject *)__pyx_v_obs));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2275, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) __PYX_ERR(0, 2275, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2275, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2275, __pyx_L1_error)
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_fltr, ((PyArrayObject *)__pyx_t_5));
  __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_v_obs0 = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":2280
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 * 
 *         # Read in initial conditions priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_check_length, __pyx_t_5) < 0) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2278, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_14 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_t_14);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_8,&__pyx_t_4,&__pyx_t_1,&__pyx_t_9,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2278, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_8,&__pyx_t_4,&__pyx_t_1,&__pyx_t_9,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14};
    __pyx_t_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_15)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_10(__pyx_t_15); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_15), 8) < 0) __PYX_ERR(0, 2278, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2278, __pyx_L1_error)
    __pyx_L12_unpacking_done:;
  }

  /* "pyross/inference.pyx":2278
 * 
 *         # Read in parameter priors
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \             # <<<<<<<<<<<<<<
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_param_prior_names = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_keys = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_param_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_param_stds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_param_bounds = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_param_guess_range = __pyx_t_12;
  __pyx_t_12 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_13;
  __pyx_t_13 = 0;
  __pyx_v_scaled_param_guesses = __pyx_t_14;
  __pyx_t_14 = 0;

  /* "pyross/inference.pyx":2284
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 * 
 *         # Concatenate the flattend parameter guess with init guess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_pyross); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_utils); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_16 = PyObject_Length(__pyx_v_obs0); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2284, __pyx_L1_error)
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_14)) {
    PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_init_priors, __pyx_t_13, __pyx_t_12};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2284, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
    PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_init_priors, __pyx_t_13, __pyx_t_12};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2284, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_11) {
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); __pyx_t_11 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_7, __pyx_t_12);
    __pyx_t_13 = 0;
    __pyx_t_12 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2283, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_14,&__pyx_t_9,&__pyx_t_12,&__pyx_t_13,&__pyx_t_11,&__pyx_t_1};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2283, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_14,&__pyx_t_9,&__pyx_t_12,&__pyx_t_13,&__pyx_t_11,&__pyx_t_1};
    __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_10(__pyx_t_4); if (unlikely(!item)) goto __pyx_L13_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_4), 6) < 0) __PYX_ERR(0, 2283, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L14_unpacking_done;
    __pyx_L13_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2283, __pyx_L1_error)
    __pyx_L14_unpacking_done:;
  }

  /* "pyross/inference.pyx":2283
 * 
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 * 
 */
  __pyx_v_init_prior_names = __pyx_t_14;
  __pyx_t_14 = 0;
  __pyx_v_init_guess = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_init_stds = __pyx_t_12;
  __pyx_t_12 = 0;
  __pyx_v_init_bounds = __pyx_t_13;
  __pyx_t_13 = 0;
  __pyx_v_init_flags = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_init_fltrs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2287
 * 
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]             # <<<<<<<<<<<<<<
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_param_guess, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_param_length = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2288
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyList_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(__pyx_v_param_guess);
  __Pyx_GIVEREF(__pyx_v_param_guess);
  PyList_SET_ITEM(__pyx_t_11, 0, __pyx_v_param_guess);
  __Pyx_INCREF(__pyx_v_init_guess);
  __Pyx_GIVEREF(__pyx_v_init_guess);
  PyList_SET_ITEM(__pyx_t_11, 1, __pyx_v_init_guess);
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
    }
  }
  __pyx_t_5 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
    }
  }
  __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_11, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2289
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_param_stds);
  __Pyx_GIVEREF(__pyx_v_param_stds);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_param_stds);
  __Pyx_INCREF(__pyx_v_init_stds);
  __Pyx_GIVEREF(__pyx_v_init_stds);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_init_stds);
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_13 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_astype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_5, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_13);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2290
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyList_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(__pyx_v_param_bounds);
  __Pyx_GIVEREF(__pyx_v_param_bounds);
  PyList_SET_ITEM(__pyx_t_11, 0, __pyx_v_param_bounds);
  __Pyx_INCREF(__pyx_v_init_bounds);
  __Pyx_GIVEREF(__pyx_v_init_bounds);
  PyList_SET_ITEM(__pyx_t_11, 1, __pyx_v_init_bounds);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 2290, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_astype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_5, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2292
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         ndim = len(guess)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Prior); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyNumber_Add(__pyx_v_param_prior_names, __pyx_v_init_prior_names); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_12, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_12, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  {
    __pyx_t_13 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_t_12);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_7, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_7, __pyx_v_stds);
    __pyx_t_12 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_prior = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2294
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 * 
 *         ndim = len(guess)             # <<<<<<<<<<<<<<
 * 
 *         if nwalkers is None:
 */
  __pyx_t_16 = PyObject_Length(__pyx_v_guess); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2294, __pyx_L1_error)
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ndim = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2296
 *         ndim = len(guess)
 * 
 *         if nwalkers is None:             # <<<<<<<<<<<<<<
 *             nwalkers = 2*ndim
 * 
 */
  __pyx_t_3 = (__pyx_v_nwalkers == Py_None);
  __pyx_t_6 = (__pyx_t_3 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":2297
 * 
 *         if nwalkers is None:
 *             nwalkers = 2*ndim             # <<<<<<<<<<<<<<
 * 
 *         logpost_args = {'generator':generator, 'intervention_fun':intervention_fun, 'bounds':bounds, 'param_keys':keys,
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_nwalkers, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2296
 *         ndim = len(guess)
 * 
 *         if nwalkers is None:             # <<<<<<<<<<<<<<
 *             nwalkers = 2*ndim
 * 
 */
  }

  /* "pyross/inference.pyx":2299
 *             nwalkers = 2*ndim
 * 
 *         logpost_args = {'generator':generator, 'intervention_fun':intervention_fun, 'bounds':bounds, 'param_keys':keys,             # <<<<<<<<<<<<<<
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_generator, __pyx_v_generator) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_bounds, __pyx_v_bounds) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)

  /* "pyross/inference.pyx":2300
 * 
 *         logpost_args = {'generator':generator, 'intervention_fun':intervention_fun, 'bounds':bounds, 'param_keys':keys,
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)

  /* "pyross/inference.pyx":2301
 *         logpost_args = {'generator':generator, 'intervention_fun':intervention_fun, 'bounds':bounds, 'param_keys':keys,
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,             # <<<<<<<<<<<<<<
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                         'prior':prior, 'tangent':tangent}
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs, ((PyObject *)__pyx_v_obs)) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)

  /* "pyross/inference.pyx":2302
 *                         'param_guess_range':param_guess_range, 'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *                         'prior':prior, 'tangent':tangent}
 * 
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fltr, ((PyObject *)__pyx_v_fltr)) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs0, __pyx_v_obs0) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)

  /* "pyross/inference.pyx":2303
 *                         'scaled_param_guesses':scaled_param_guesses, 'param_length':param_length, 'obs':obs,
 *                         'fltr':fltr, 'Tf':Tf, 'obs0':obs0, 'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                         'prior':prior, 'tangent':tangent}             # <<<<<<<<<<<<<<
 * 
 *         if walker_pos is None:
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  __pyx_v_logpost_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2305
 *                         'prior':prior, 'tangent':tangent}
 * 
 *         if walker_pos is None:             # <<<<<<<<<<<<<<
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)
 */
  __pyx_t_6 = (__pyx_v_walker_pos == Py_None);
  __pyx_t_3 = (__pyx_t_6 != 0);
  if (__pyx_t_3) {

    /* "pyross/inference.pyx":2307
 *         if walker_pos is None:
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)             # <<<<<<<<<<<<<<
 *             p0 = prior.ppf(points)
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_random); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_rand); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_nwalkers, __pyx_v_ndim};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2307, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_nwalkers, __pyx_v_ndim};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2307, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_13) {
        __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
      }
      __Pyx_INCREF(__pyx_v_nwalkers);
      __Pyx_GIVEREF(__pyx_v_nwalkers);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_7, __pyx_v_nwalkers);
      __Pyx_INCREF(__pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_v_ndim);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_7, __pyx_v_ndim);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_points = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2308
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)
 *             p0 = prior.ppf(points)             # <<<<<<<<<<<<<<
 *         else:
 *             p0 = walker_pos
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_ppf); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_v_points) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_points);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_p0 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2305
 *                         'prior':prior, 'tangent':tangent}
 * 
 *         if walker_pos is None:             # <<<<<<<<<<<<<<
 *              # If not specified, sample initial positions of walkers from prior (within bounds).
 *             points = np.random.rand(nwalkers, ndim)
 */
    goto __pyx_L16;
  }

  /* "pyross/inference.pyx":2310
 *             p0 = prior.ppf(points)
 *         else:
 *             p0 = walker_pos             # <<<<<<<<<<<<<<
 * 
 *         if sampler is None:
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_walker_pos);
    __pyx_v_p0 = __pyx_v_walker_pos;
  }
  __pyx_L16:;

  /* "pyross/inference.pyx":2312
 *             p0 = walker_pos
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:
 */
  __pyx_t_3 = (__pyx_v_sampler == Py_None);
  __pyx_t_6 = (__pyx_t_3 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":2314
 *         if sampler is None:
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2314, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2314, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {

      /* "pyross/inference.pyx":2315
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,
 *                                                 kwargs=logpost_args, pool=mcmc_pool)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_mcmc_pool = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2316
 *             if nprocesses > 1:
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,             # <<<<<<<<<<<<<<
 *                                                 kwargs=logpost_args, pool=mcmc_pool)
 *             else:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_emcee); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2316, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_EnsembleSampler); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2316, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior_latent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2316, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2316, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_v_nwalkers);
      __Pyx_GIVEREF(__pyx_v_nwalkers);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_nwalkers);
      __Pyx_INCREF(__pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_v_ndim);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2317
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,
 *                                                 kwargs=logpost_args, pool=mcmc_pool)             # <<<<<<<<<<<<<<
 *             else:
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,
 */
      __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_kwargs, __pyx_v_logpost_args) < 0) __PYX_ERR(0, 2317, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_pool, __pyx_v_mcmc_pool) < 0) __PYX_ERR(0, 2317, __pyx_L1_error)

      /* "pyross/inference.pyx":2316
 *             if nprocesses > 1:
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,             # <<<<<<<<<<<<<<
 *                                                 kwargs=logpost_args, pool=mcmc_pool)
 *             else:
 */
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2316, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "pyross/inference.pyx":2314
 *         if sampler is None:
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 mcmc_pool = pathos_mp.ProcessingPool(nprocesses)
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,
 */
      goto __pyx_L18;
    }

    /* "pyross/inference.pyx":2319
 *                                                 kwargs=logpost_args, pool=mcmc_pool)
 *             else:
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,             # <<<<<<<<<<<<<<
 *                                                 kwargs=logpost_args)
 * 
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_emcee); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_EnsembleSampler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_logposterior_latent); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_v_nwalkers);
      __Pyx_GIVEREF(__pyx_v_nwalkers);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_nwalkers);
      __Pyx_INCREF(__pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_v_ndim);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_ndim);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "pyross/inference.pyx":2320
 *             else:
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,
 *                                                 kwargs=logpost_args)             # <<<<<<<<<<<<<<
 * 
 *             sampler.run_mcmc(p0, nsamples, progress=verbose)
 */
      __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_kwargs, __pyx_v_logpost_args) < 0) __PYX_ERR(0, 2320, __pyx_L1_error)

      /* "pyross/inference.pyx":2319
 *                                                 kwargs=logpost_args, pool=mcmc_pool)
 *             else:
 *                 sampler = emcee.EnsembleSampler(nwalkers, ndim, self._logposterior_latent,             # <<<<<<<<<<<<<<
 *                                                 kwargs=logpost_args)
 * 
 */
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF_SET(__pyx_v_sampler, __pyx_t_12);
      __pyx_t_12 = 0;
    }
    __pyx_L18:;

    /* "pyross/inference.pyx":2322
 *                                                 kwargs=logpost_args)
 * 
 *             sampler.run_mcmc(p0, nsamples, progress=verbose)             # <<<<<<<<<<<<<<
 *         else:
 *             # Continue running an existing MCMC chain.
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_run_mcmc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_v_p0);
    __Pyx_GIVEREF(__pyx_v_p0);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_p0);
    __Pyx_INCREF(__pyx_v_nsamples);
    __Pyx_GIVEREF(__pyx_v_nsamples);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_nsamples);
    __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_progress, __pyx_v_verbose) < 0) __PYX_ERR(0, 2322, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2312
 *             p0 = walker_pos
 * 
 *         if sampler is None:             # <<<<<<<<<<<<<<
 *             # Start a new MCMC chain.
 *             if nprocesses > 1:
 */
    goto __pyx_L17;
  }

  /* "pyross/inference.pyx":2325
 *         else:
 *             # Continue running an existing MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 */
  /*else*/ {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_nprocesses, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2325, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2325, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {

      /* "pyross/inference.pyx":2327
 *             if nprocesses > 1:
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)             # <<<<<<<<<<<<<<
 *             elif sampler.pool is not None:
 *                 # If the user decided to not have multiprocessing in a subsequent run, we need
 */
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pathos_mp); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ProcessingPool); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
        }
      }
      __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_11, __pyx_v_nprocesses) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_nprocesses);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, __pyx_t_1) < 0) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyross/inference.pyx":2325
 *         else:
 *             # Continue running an existing MCMC chain.
 *             if nprocesses > 1:             # <<<<<<<<<<<<<<
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 */
      goto __pyx_L19;
    }

    /* "pyross/inference.pyx":2328
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 # If the user decided to not have multiprocessing in a subsequent run, we need
 *                 # to reset the pool in the emcee.EnsembleSampler.
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = (__pyx_t_6 != 0);
    if (__pyx_t_3) {

      /* "pyross/inference.pyx":2331
 *                 # If the user decided to not have multiprocessing in a subsequent run, we need
 *                 # to reset the pool in the emcee.EnsembleSampler.
 *                 sampler.pool = None             # <<<<<<<<<<<<<<
 * 
 *             sampler.run_mcmc(None, nsamples, progress=verbose)
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_sampler, __pyx_n_s_pool, Py_None) < 0) __PYX_ERR(0, 2331, __pyx_L1_error)

      /* "pyross/inference.pyx":2328
 *                 # Restart the pool we closed at the end of the previous run.
 *                 sampler.pool = pathos_mp.ProcessingPool(nprocesses)
 *             elif sampler.pool is not None:             # <<<<<<<<<<<<<<
 *                 # If the user decided to not have multiprocessing in a subsequent run, we need
 *                 # to reset the pool in the emcee.EnsembleSampler.
 */
    }
    __pyx_L19:;

    /* "pyross/inference.pyx":2333
 *                 sampler.pool = None
 * 
 *             sampler.run_mcmc(None, nsamples, progress=verbose)             # <<<<<<<<<<<<<<
 * 
 *         if sampler.pool is not None:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_run_mcmc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_13, 0, Py_None);
    __Pyx_INCREF(__pyx_v_nsamples);
    __Pyx_GIVEREF(__pyx_v_nsamples);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_nsamples);
    __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_progress, __pyx_v_verbose) < 0) __PYX_ERR(0, 2333, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __pyx_L17:;

  /* "pyross/inference.pyx":2335
 *             sampler.run_mcmc(None, nsamples, progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = (__pyx_t_12 != Py_None);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_6 = (__pyx_t_3 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":2336
 * 
 *         if sampler.pool is not None:
 *             sampler.pool.close()             # <<<<<<<<<<<<<<
 *             sampler.pool.join()
 *             sampler.pool.clear()
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_close); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    __pyx_t_12 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "pyross/inference.pyx":2337
 *         if sampler.pool is not None:
 *             sampler.pool.close()
 *             sampler.pool.join()             # <<<<<<<<<<<<<<
 *             sampler.pool.clear()
 * 
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_join); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "pyross/inference.pyx":2338
 *             sampler.pool.close()
 *             sampler.pool.join()
 *             sampler.pool.clear()             # <<<<<<<<<<<<<<
 * 
 *         return sampler
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_pool); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_clear); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    __pyx_t_12 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "pyross/inference.pyx":2335
 *             sampler.run_mcmc(None, nsamples, progress=verbose)
 * 
 *         if sampler.pool is not None:             # <<<<<<<<<<<<<<
 *             sampler.pool.close()
 *             sampler.pool.join()
 */
  }

  /* "pyross/inference.pyx":2340
 *             sampler.pool.clear()
 * 
 *         return sampler             # <<<<<<<<<<<<<<
 * 
 *     def latent_infer_mcmc_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sampler);
  __pyx_r = __pyx_v_sampler;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2181
 *         return result, output_samples
 * 
 *     def latent_infer_mcmc(self, np.ndarray obs, np.ndarray fltr, Tf, param_priors, init_priors, contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                           intervention_fun=None, tangent=False, verbose=False, sampler=None, nwalkers=None, walker_pos=None,
 *                           nsamples=1000, nprocesses=0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_mcmc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_param_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_param_guess);
  __Pyx_XDECREF(__pyx_v_param_stds);
  __Pyx_XDECREF(__pyx_v_param_bounds);
  __Pyx_XDECREF(__pyx_v_param_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_param_guesses);
  __Pyx_XDECREF(__pyx_v_init_prior_names);
  __Pyx_XDECREF(__pyx_v_init_guess);
  __Pyx_XDECREF(__pyx_v_init_stds);
  __Pyx_XDECREF(__pyx_v_init_bounds);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_param_length);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_ndim);
  __Pyx_XDECREF(__pyx_v_logpost_args);
  __Pyx_XDECREF(__pyx_v_points);
  __Pyx_XDECREF(__pyx_v_p0);
  __Pyx_XDECREF(__pyx_v_mcmc_pool);
  __Pyx_XDECREF((PyObject *)__pyx_v_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_fltr);
  __Pyx_XDECREF(__pyx_v_sampler);
  __Pyx_XDECREF(__pyx_v_nwalkers);
  __Pyx_XDECREF(__pyx_v_nprocesses);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2342
 *         return sampler
 * 
 *     def latent_infer_mcmc_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                          generator=None, intervention_fun=None, flat=True, discard=0, thin=1,
 *                                          **catchall_kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_81latent_infer_mcmc_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_80latent_infer_mcmc_process_result[] = "\n        Take the sampler generated by `pyross.inference.latent_infer_mcmc` and produce output dictionaries for\n        further use in the pyross framework.\n\n        Parameters\n        ----------\n        sampler: emcee.EnsembleSampler\n            Output of `mcmc_latent_inference`.\n        obs: 2d numpy.array\n        fltr: 2d numpy.array\n        param_priors: dict\n        init_priors: dict\n        contactMatrix: callable, optional\n        generator: pyross.contactMatrix, optional\n        intervention_fun: callable, optional\n        flat: bool, optional\n            This decides whether to return the samples as for each chain separately (False) or as as a combined\n            list (True). Default is True.\n        discard: int, optional\n            The number of initial samples to discard in each chain (to account for burn-in). Default is 0.\n        thin: int, optional\n            Thin out the chain by taking only the n-tn element in each chain. Default is 1 (no thinning).\n        **catchall_kwargs: dict\n            Catches further provided arguments and ignores them.\n\n        Returns\n        -------\n        output_samples: list of dict (if flat=True), or list of list of dict (if flat=False)\n            The processed posterior samples.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_81latent_infer_mcmc_process_result(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sampler = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_flat = 0;
  PyObject *__pyx_v_discard = 0;
  PyObject *__pyx_v_thin = 0;
  CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_infer_mcmc_process_result (wrapper)", 0);
  __pyx_v_catchall_kwargs = PyDict_New(); if (unlikely(!__pyx_v_catchall_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_catchall_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sampler,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_flat,&__pyx_n_s_discard,&__pyx_n_s_thin,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2343
 * 
 *     def latent_infer_mcmc_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,
 *                                          generator=None, intervention_fun=None, flat=True, discard=0, thin=1,             # <<<<<<<<<<<<<<
 *                                          **catchall_kwargs):
 *         """
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_True);
    values[9] = ((PyObject *)__pyx_int_0);
    values[10] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc_process_result", 0, 5, 11, 1); __PYX_ERR(0, 2342, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc_process_result", 0, 5, 11, 2); __PYX_ERR(0, 2342, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc_process_result", 0, 5, 11, 3); __PYX_ERR(0, 2342, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc_process_result", 0, 5, 11, 4); __PYX_ERR(0, 2342, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flat);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_discard);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thin);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_catchall_kwargs, values, pos_args, "latent_infer_mcmc_process_result") < 0)) __PYX_ERR(0, 2342, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sampler = values[0];
    __pyx_v_obs = values[1];
    __pyx_v_fltr = values[2];
    __pyx_v_param_priors = values[3];
    __pyx_v_init_priors = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
    __pyx_v_flat = values[8];
    __pyx_v_discard = values[9];
    __pyx_v_thin = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_infer_mcmc_process_result", 0, 5, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2342, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_catchall_kwargs); __pyx_v_catchall_kwargs = 0;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_mcmc_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_80latent_infer_mcmc_process_result(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sampler, __pyx_v_obs, __pyx_v_fltr, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_flat, __pyx_v_discard, __pyx_v_thin, __pyx_v_catchall_kwargs);

  /* "pyross/inference.pyx":2342
 *         return sampler
 * 
 *     def latent_infer_mcmc_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                          generator=None, intervention_fun=None, flat=True, discard=0, thin=1,
 *                                          **catchall_kwargs):
 */

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_catchall_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_80latent_infer_mcmc_process_result(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sampler, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_flat, PyObject *__pyx_v_discard, PyObject *__pyx_v_thin, CYTHON_UNUSED PyObject *__pyx_v_catchall_kwargs) {
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_param_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_param_guess = NULL;
  PyObject *__pyx_v_param_stds = NULL;
  PyObject *__pyx_v_param_bounds = NULL;
  PyObject *__pyx_v_param_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_param_guesses = NULL;
  PyObject *__pyx_v_init_prior_names = NULL;
  PyObject *__pyx_v_init_guess = NULL;
  PyObject *__pyx_v_init_stds = NULL;
  PyObject *__pyx_v_init_bounds = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_param_length = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_samples = NULL;
  PyObject *__pyx_v_log_posts = NULL;
  PyObject *__pyx_v_samples_per_chain = NULL;
  PyObject *__pyx_v_nr_chains = NULL;
  PyObject *__pyx_v_output_samples = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_v_weight = NULL;
  PyObject *__pyx_v_param_sample = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_init_sample = NULL;
  PyObject *__pyx_v_sample_params_dict = NULL;
  PyObject *__pyx_v_sample_control_params_dict = NULL;
  PyObject *__pyx_v_sample_x0 = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_output_dict = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr3__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  PyObject *(*__pyx_t_15)(PyObject *);
  Py_ssize_t __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  int __pyx_t_18;
  int __pyx_t_19;
  __Pyx_RefNannySetupContext("latent_infer_mcmc_process_result", 0);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);

  /* "pyross/inference.pyx":2376
 *         """
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2376, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2376, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2379
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_fltr);
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2379, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 2379, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2379, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_fltr, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_obs0 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2384
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 * 
 *         # Read in initial conditions priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_check_length, __pyx_t_2) < 0) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2382, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
    __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_12)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_12); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_12), 8) < 0) __PYX_ERR(0, 2382, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2382, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }

  /* "pyross/inference.pyx":2382
 * 
 *         # Read in parameter priors
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \             # <<<<<<<<<<<<<<
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_param_prior_names = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_keys = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_param_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_param_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_param_bounds = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_param_guess_range = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_scaled_param_guesses = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "pyross/inference.pyx":2388
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 * 
 *         # Concatenate the flattend parameter guess with init guess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pyross); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_utils); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_13 = PyObject_Length(__pyx_v_obs0); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2388, __pyx_L1_error)
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2388, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2388, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_t_9);
    __pyx_t_10 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2387, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2387, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
    __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_3); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 6) < 0) __PYX_ERR(0, 2387, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2387, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }

  /* "pyross/inference.pyx":2387
 * 
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 * 
 */
  __pyx_v_init_prior_names = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_init_guess = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_init_stds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_init_bounds = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_init_flags = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_init_fltrs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2391
 * 
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]             # <<<<<<<<<<<<<<
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_param_guess, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_param_length = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2392
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_guess);
  __Pyx_GIVEREF(__pyx_v_param_guess);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_guess);
  __Pyx_INCREF(__pyx_v_init_guess);
  __Pyx_GIVEREF(__pyx_v_init_guess);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_guess);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2393
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_stds);
  __Pyx_GIVEREF(__pyx_v_param_stds);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_param_stds);
  __Pyx_INCREF(__pyx_v_init_stds);
  __Pyx_GIVEREF(__pyx_v_init_stds);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_init_stds);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2394
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_bounds);
  __Pyx_GIVEREF(__pyx_v_param_bounds);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_bounds);
  __Pyx_INCREF(__pyx_v_init_bounds);
  __Pyx_GIVEREF(__pyx_v_init_bounds);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_bounds);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 2394, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2396
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 * 
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Add(__pyx_v_param_prior_names, __pyx_v_init_prior_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2396, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2396, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_prior = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2398
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 * 
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)             # <<<<<<<<<<<<<<
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)
 *         samples_per_chain = samples.shape[0]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_get_chain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_flat, __pyx_v_flat) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_thin, __pyx_v_thin) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_discard, __pyx_v_discard) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_samples = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":2399
 * 
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)             # <<<<<<<<<<<<<<
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sampler, __pyx_n_s_get_log_prob); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_flat, __pyx_v_flat) < 0) __PYX_ERR(0, 2399, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_thin, __pyx_v_thin) < 0) __PYX_ERR(0, 2399, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_discard, __pyx_v_discard) < 0) __PYX_ERR(0, 2399, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_log_posts = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2400
 *         samples = sampler.get_chain(flat=flat, thin=thin, discard=discard)
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)
 *         samples_per_chain = samples.shape[0]             # <<<<<<<<<<<<<<
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_samples, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_samples_per_chain = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":2401
 *         log_posts = sampler.get_log_prob(flat=flat, thin=thin, discard=discard)
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]             # <<<<<<<<<<<<<<
 *         if flat:
 *             output_samples = []
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2401, __pyx_L1_error)
  if (__pyx_t_14) {
    __Pyx_INCREF(__pyx_int_1);
    __pyx_t_8 = __pyx_int_1;
  } else {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_samples, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __pyx_v_nr_chains = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyross/inference.pyx":2402
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:             # <<<<<<<<<<<<<<
 *             output_samples = []
 *         else:
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2402, __pyx_L1_error)
  if (__pyx_t_14) {

    /* "pyross/inference.pyx":2403
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:
 *             output_samples = []             # <<<<<<<<<<<<<<
 *         else:
 *             output_samples = [[] for _ in nr_chains]
 */
    __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_output_samples = ((PyObject*)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":2402
 *         samples_per_chain = samples.shape[0]
 *         nr_chains = 1 if flat else samples.shape[1]
 *         if flat:             # <<<<<<<<<<<<<<
 *             output_samples = []
 *         else:
 */
    goto __pyx_L9;
  }

  /* "pyross/inference.pyx":2405
 *             output_samples = []
 *         else:
 *             output_samples = [[] for _ in nr_chains]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(samples_per_chain):
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2405, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (likely(PyList_CheckExact(__pyx_v_nr_chains)) || PyTuple_CheckExact(__pyx_v_nr_chains)) {
        __pyx_t_10 = __pyx_v_nr_chains; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
        __pyx_t_15 = NULL;
      } else {
        __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_nr_chains); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2405, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2405, __pyx_L12_error)
      }
      for (;;) {
        if (likely(!__pyx_t_15)) {
          if (likely(PyList_CheckExact(__pyx_t_10))) {
            if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2405, __pyx_L12_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2405, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2405, __pyx_L12_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2405, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_15(__pyx_t_10);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 2405, __pyx_L12_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v__, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2405, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 2405, __pyx_L12_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v__); __pyx_8genexpr3__pyx_v__ = 0;
      goto __pyx_L15_exit_scope;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v__); __pyx_8genexpr3__pyx_v__ = 0;
      goto __pyx_L1_error;
      __pyx_L15_exit_scope:;
    } /* exit inner scope */
    __pyx_v_output_samples = ((PyObject*)__pyx_t_8);
    __pyx_t_8 = 0;
  }
  __pyx_L9:;

  /* "pyross/inference.pyx":2407
 *             output_samples = [[] for _ in nr_chains]
 * 
 *         for i in range(samples_per_chain):             # <<<<<<<<<<<<<<
 *             for j in range(nr_chains):
 *                 if flat:
 */
  __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_samples_per_chain); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
    __pyx_t_10 = __pyx_t_8; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
    __pyx_t_15 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2407, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  for (;;) {
    if (likely(!__pyx_t_15)) {
      if (likely(PyList_CheckExact(__pyx_t_10))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2407, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2407, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2407, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2407, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      }
    } else {
      __pyx_t_8 = __pyx_t_15(__pyx_t_10);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2407, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":2408
 * 
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):             # <<<<<<<<<<<<<<
 *                 if flat:
 *                     sample = samples[i,:]
 */
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nr_chains); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
      __pyx_t_1 = __pyx_t_8; __Pyx_INCREF(__pyx_t_1); __pyx_t_16 = 0;
      __pyx_t_17 = NULL;
    } else {
      __pyx_t_16 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2408, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_17 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 2408, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    for (;;) {
      if (likely(!__pyx_t_17)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 2408, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2408, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 2408, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2408, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_17(__pyx_t_1);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2408, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "pyross/inference.pyx":2409
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     sample = samples[i,:]
 *                     l_post = log_posts[i]
 */
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2409, __pyx_L1_error)
      if (__pyx_t_14) {

        /* "pyross/inference.pyx":2410
 *             for j in range(nr_chains):
 *                 if flat:
 *                     sample = samples[i,:]             # <<<<<<<<<<<<<<
 *                     l_post = log_posts[i]
 *                 else:
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2410, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_slice_);
        __Pyx_GIVEREF(__pyx_slice_);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_slice_);
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_samples, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2410, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "pyross/inference.pyx":2411
 *                 if flat:
 *                     sample = samples[i,:]
 *                     l_post = log_posts[i]             # <<<<<<<<<<<<<<
 *                 else:
 *                     sample = samples[i, j, :]
 */
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_log_posts, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2411, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "pyross/inference.pyx":2409
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     sample = samples[i,:]
 *                     l_post = log_posts[i]
 */
        goto __pyx_L20;
      }

      /* "pyross/inference.pyx":2413
 *                     l_post = log_posts[i]
 *                 else:
 *                     sample = samples[i, j, :]             # <<<<<<<<<<<<<<
 *                     l_post = log_posts[i]
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 */
      /*else*/ {
        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2413, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_j);
        __Pyx_INCREF(__pyx_slice_);
        __Pyx_GIVEREF(__pyx_slice_);
        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_slice_);
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_samples, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2413, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "pyross/inference.pyx":2414
 *                 else:
 *                     sample = samples[i, j, :]
 *                     l_post = log_posts[i]             # <<<<<<<<<<<<<<
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 *                 param_sample = sample[:param_length]
 */
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_log_posts, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_8);
        __pyx_t_8 = 0;
      }
      __pyx_L20:;

      /* "pyross/inference.pyx":2415
 *                     sample = samples[i, j, :]
 *                     l_post = log_posts[i]
 *                 weight = 1.0 / (samples_per_chain * nr_chains)             # <<<<<<<<<<<<<<
 *                 param_sample = sample[:param_length]
 *                 orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 */
      __pyx_t_8 = PyNumber_Multiply(__pyx_v_samples_per_chain, __pyx_v_nr_chains); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_0, __pyx_t_8, 1.0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_weight, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2416
 *                     l_post = log_posts[i]
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 *                 param_sample = sample[:param_length]             # <<<<<<<<<<<<<<
 *                 orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 *                                                                 is_scale_parameter, scaled_param_guesses)
 */
      __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_sample, 0, 0, NULL, &__pyx_v_param_length, NULL, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_param_sample, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2417
 *                 weight = 1.0 / (samples_per_chain * nr_chains)
 *                 param_sample = sample[:param_length]
 *                 orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,             # <<<<<<<<<<<<<<
 *                                                                 is_scale_parameter, scaled_param_guesses)
 *                 init_sample = sample[param_length:]
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyross); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyross/inference.pyx":2418
 *                 param_sample = sample[:param_length]
 *                 orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 *                                                                 is_scale_parameter, scaled_param_guesses)             # <<<<<<<<<<<<<<
 *                 init_sample = sample[param_length:]
 * 
 */
      __pyx_t_2 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_sample, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2417, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_sample, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2417, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2417, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_v_param_sample);
        __Pyx_GIVEREF(__pyx_v_param_sample);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_param_sample);
        __Pyx_INCREF(__pyx_v_param_guess_range);
        __Pyx_GIVEREF(__pyx_v_param_guess_range);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_param_guess_range);
        __Pyx_INCREF(__pyx_v_is_scale_parameter);
        __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
        PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_v_is_scale_parameter);
        __Pyx_INCREF(__pyx_v_scaled_param_guesses);
        __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
        PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_4, __pyx_v_scaled_param_guesses);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2417, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_orig_params, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2419
 *                 orig_params = pyross.utils.unflatten_parameters(param_sample, param_guess_range,
 *                                                                 is_scale_parameter, scaled_param_guesses)
 *                 init_sample = sample[param_length:]             # <<<<<<<<<<<<<<
 * 
 *                 sample_params_dict, sample_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 */
      __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_sample, 0, 0, &__pyx_v_param_length, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_init_sample, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2421
 *                 init_sample = sample[param_length:]
 * 
 *                 sample_params_dict, sample_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *                 self.set_params(sample_params_dict)
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_keys);
      __Pyx_GIVEREF(__pyx_v_keys);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_keys);
      __Pyx_INCREF(__pyx_v_orig_params);
      __Pyx_GIVEREF(__pyx_v_orig_params);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_orig_params);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 2421, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2421, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L21_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L21_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < 0) __PYX_ERR(0, 2421, __pyx_L1_error)
        __pyx_t_7 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L22_unpacking_done;
        __pyx_L21_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_7 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 2421, __pyx_L1_error)
        __pyx_L22_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_sample_params_dict, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_sample_control_params_dict, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "pyross/inference.pyx":2422
 * 
 *                 sample_params_dict, sample_control_params_dict = self.fill_params_dict(keys, orig_params, return_additional_params=True)
 *                 self.set_params(sample_params_dict)             # <<<<<<<<<<<<<<
 * 
 *                 if generator is not None:
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_sample_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_sample_params_dict);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyross/inference.pyx":2424
 *                 self.set_params(sample_params_dict)
 * 
 *                 if generator is not None:             # <<<<<<<<<<<<<<
 *                     if intervention_fun is None:
 *                         self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 */
      __pyx_t_14 = (__pyx_v_generator != Py_None);
      __pyx_t_18 = (__pyx_t_14 != 0);
      if (__pyx_t_18) {

        /* "pyross/inference.pyx":2425
 * 
 *                 if generator is not None:
 *                     if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                         self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 *                     else:
 */
        __pyx_t_18 = (__pyx_v_intervention_fun == Py_None);
        __pyx_t_14 = (__pyx_t_18 != 0);
        if (__pyx_t_14) {

          /* "pyross/inference.pyx":2426
 *                 if generator is not None:
 *                     if intervention_fun is None:
 *                         self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **sample_control_params_dict)
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__pyx_v_sample_control_params_dict == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2426, __pyx_L1_error)
          }
          if (likely(PyDict_CheckExact(__pyx_v_sample_control_params_dict))) {
            __pyx_t_8 = PyDict_Copy(__pyx_v_sample_control_params_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2426, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          } else {
            __pyx_t_8 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_sample_control_params_dict, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2426, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          }
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GIVEREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_v_self->contactMatrix);
          __Pyx_DECREF(__pyx_v_self->contactMatrix);
          __pyx_v_self->contactMatrix = __pyx_t_6;
          __pyx_t_6 = 0;

          /* "pyross/inference.pyx":2425
 * 
 *                 if generator is not None:
 *                     if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                         self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 *                     else:
 */
          goto __pyx_L24;
        }

        /* "pyross/inference.pyx":2428
 *                         self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 *                     else:
 *                         self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **sample_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *                 sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])
 */
        /*else*/ {
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2428, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2428, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_v_intervention_fun);
          __Pyx_GIVEREF(__pyx_v_intervention_fun);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_intervention_fun);
          if (unlikely(__pyx_v_sample_control_params_dict == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2428, __pyx_L1_error)
          }
          if (likely(PyDict_CheckExact(__pyx_v_sample_control_params_dict))) {
            __pyx_t_2 = PyDict_Copy(__pyx_v_sample_control_params_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2428, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_sample_control_params_dict, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2428, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2428, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GIVEREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_v_self->contactMatrix);
          __Pyx_DECREF(__pyx_v_self->contactMatrix);
          __pyx_v_self->contactMatrix = __pyx_t_9;
          __pyx_t_9 = 0;
        }
        __pyx_L24:;

        /* "pyross/inference.pyx":2424
 *                 self.set_params(sample_params_dict)
 * 
 *                 if generator is not None:             # <<<<<<<<<<<<<<
 *                     if intervention_fun is None:
 *                         self.contactMatrix = generator.constant_contactMatrix(**sample_control_params_dict)
 */
      }

      /* "pyross/inference.pyx":2430
 *                         self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **sample_control_params_dict)
 * 
 *                 sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])             # <<<<<<<<<<<<<<
 *                 l_prior = np.sum(prior.logpdf(sample))
 *                 l_like = l_post - l_prior
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_fltr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_init_sample, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_8};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2430, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_init_sample, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_8};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2430, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_v_init_sample);
        __Pyx_GIVEREF(__pyx_v_init_sample);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_4, __pyx_v_init_sample);
        __Pyx_INCREF(__pyx_v_init_flags);
        __Pyx_GIVEREF(__pyx_v_init_flags);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_4, __pyx_v_init_flags);
        __Pyx_INCREF(__pyx_v_init_fltrs);
        __Pyx_GIVEREF(__pyx_v_init_fltrs);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_4, __pyx_v_init_fltrs);
        __Pyx_INCREF(__pyx_v_obs0);
        __Pyx_GIVEREF(__pyx_v_obs0);
        PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_4, __pyx_v_obs0);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_4, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_sample_x0, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2431
 * 
 *                 sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])
 *                 l_prior = np.sum(prior.logpdf(sample))             # <<<<<<<<<<<<<<
 *                 l_like = l_post - l_prior
 *                 output_dict = {
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_sample) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_sample);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_2);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_l_prior, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2432
 *                 sample_x0 = self._construct_inits(init_sample, init_flags, init_fltrs, obs0, fltr[0])
 *                 l_prior = np.sum(prior.logpdf(sample))
 *                 l_like = l_post - l_prior             # <<<<<<<<<<<<<<
 *                 output_dict = {
 *                     'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,
 */
      __pyx_t_9 = PyNumber_Subtract(__pyx_v_l_post, __pyx_v_l_prior); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_l_like, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2434
 *                 l_like = l_post - l_prior
 *                 output_dict = {
 *                     'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,             # <<<<<<<<<<<<<<
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                     'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 */
      __pyx_t_9 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_params_dict, __pyx_v_sample_params_dict) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_x0, __pyx_v_sample_x0) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_flat_params, __pyx_v_sample) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

      /* "pyross/inference.pyx":2435
 *                 output_dict = {
 *                     'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,             # <<<<<<<<<<<<<<
 *                     'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 *                     'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

      /* "pyross/inference.pyx":2436
 *                     'params_dict':sample_params_dict, 'x0':sample_x0, 'flat_params':sample,
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                     'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,             # <<<<<<<<<<<<<<
 *                     'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *                     'scaled_param_guesses':scaled_param_guesses,
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_weight, __pyx_v_weight) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

      /* "pyross/inference.pyx":2437
 *                     'log_posterior':l_post, 'log_prior':l_prior, 'log_likelihood':l_like,
 *                     'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 *                     'is_scale_parameter':is_scale_parameter, 'param_length':param_length,             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses':scaled_param_guesses,
 *                     'init_flags': init_flags, 'init_fltrs': init_fltrs,
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

      /* "pyross/inference.pyx":2438
 *                     'weight':weight, 'param_keys': keys, 'param_guess_range': param_guess_range,
 *                     'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *                     'scaled_param_guesses':scaled_param_guesses,             # <<<<<<<<<<<<<<
 *                     'init_flags': init_flags, 'init_fltrs': init_fltrs,
 *                     'prior':prior
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

      /* "pyross/inference.pyx":2439
 *                     'is_scale_parameter':is_scale_parameter, 'param_length':param_length,
 *                     'scaled_param_guesses':scaled_param_guesses,
 *                     'init_flags': init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *                     'prior':prior
 *                 }
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

      /* "pyross/inference.pyx":2440
 *                     'scaled_param_guesses':scaled_param_guesses,
 *                     'init_flags': init_flags, 'init_fltrs': init_fltrs,
 *                     'prior':prior             # <<<<<<<<<<<<<<
 *                 }
 * 
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_prior, __pyx_v_prior) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_output_dict, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "pyross/inference.pyx":2443
 *                 }
 * 
 *                 if sample_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                     output_dict['control_params_dict'] = sample_control_params_dict
 * 
 */
      __pyx_t_9 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = PyObject_RichCompare(__pyx_v_sample_control_params_dict, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2443, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2443, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (__pyx_t_14) {

        /* "pyross/inference.pyx":2444
 * 
 *                 if sample_control_params_dict != {}:
 *                     output_dict['control_params_dict'] = sample_control_params_dict             # <<<<<<<<<<<<<<
 * 
 *                 if flat:
 */
        if (unlikely(PyDict_SetItem(__pyx_v_output_dict, __pyx_n_u_control_params_dict, __pyx_v_sample_control_params_dict) < 0)) __PYX_ERR(0, 2444, __pyx_L1_error)

        /* "pyross/inference.pyx":2443
 *                 }
 * 
 *                 if sample_control_params_dict != {}:             # <<<<<<<<<<<<<<
 *                     output_dict['control_params_dict'] = sample_control_params_dict
 * 
 */
      }

      /* "pyross/inference.pyx":2446
 *                     output_dict['control_params_dict'] = sample_control_params_dict
 * 
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     output_samples.append(output_dict)
 *                 else:
 */
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2446, __pyx_L1_error)
      if (__pyx_t_14) {

        /* "pyross/inference.pyx":2447
 * 
 *                 if flat:
 *                     output_samples.append(output_dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     output_samples[j].append(output_dict)
 */
        __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_output_samples, __pyx_v_output_dict); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 2447, __pyx_L1_error)

        /* "pyross/inference.pyx":2446
 *                     output_dict['control_params_dict'] = sample_control_params_dict
 * 
 *                 if flat:             # <<<<<<<<<<<<<<
 *                     output_samples.append(output_dict)
 *                 else:
 */
        goto __pyx_L26;
      }

      /* "pyross/inference.pyx":2449
 *                     output_samples.append(output_dict)
 *                 else:
 *                     output_samples[j].append(output_dict)             # <<<<<<<<<<<<<<
 * 
 *         return output_samples
 */
      /*else*/ {
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_output_samples, __pyx_v_j); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2449, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_19 = __Pyx_PyObject_Append(__pyx_t_11, __pyx_v_output_dict); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 2449, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __pyx_L26:;

      /* "pyross/inference.pyx":2408
 * 
 *         for i in range(samples_per_chain):
 *             for j in range(nr_chains):             # <<<<<<<<<<<<<<
 *                 if flat:
 *                     sample = samples[i,:]
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2407
 *             output_samples = [[] for _ in nr_chains]
 * 
 *         for i in range(samples_per_chain):             # <<<<<<<<<<<<<<
 *             for j in range(nr_chains):
 *                 if flat:
 */
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pyross/inference.pyx":2451
 *                     output_samples[j].append(output_dict)
 * 
 *         return output_samples             # <<<<<<<<<<<<<<
 * 
 *     def _latent_mean(self, params, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_samples);
  __pyx_r = __pyx_v_output_samples;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2342
 *         return sampler
 * 
 *     def latent_infer_mcmc_process_result(self, sampler, obs, fltr, param_priors, init_priors, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                                          generator=None, intervention_fun=None, flat=True, discard=0, thin=1,
 *                                          **catchall_kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_infer_mcmc_process_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_param_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_param_guess);
  __Pyx_XDECREF(__pyx_v_param_stds);
  __Pyx_XDECREF(__pyx_v_param_bounds);
  __Pyx_XDECREF(__pyx_v_param_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_param_guesses);
  __Pyx_XDECREF(__pyx_v_init_prior_names);
  __Pyx_XDECREF(__pyx_v_init_guess);
  __Pyx_XDECREF(__pyx_v_init_stds);
  __Pyx_XDECREF(__pyx_v_init_bounds);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_param_length);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_samples);
  __Pyx_XDECREF(__pyx_v_log_posts);
  __Pyx_XDECREF(__pyx_v_samples_per_chain);
  __Pyx_XDECREF(__pyx_v_nr_chains);
  __Pyx_XDECREF(__pyx_v_output_samples);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_weight);
  __Pyx_XDECREF(__pyx_v_param_sample);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_init_sample);
  __Pyx_XDECREF(__pyx_v_sample_params_dict);
  __Pyx_XDECREF(__pyx_v_sample_control_params_dict);
  __Pyx_XDECREF(__pyx_v_sample_x0);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_output_dict);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v__);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_XDECREF(__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2453
 *         return output_samples
 * 
 *     def _latent_mean(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_83_latent_mean(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_82_latent_mean[] = "Objective function for differentiation call in latent_FIM and latent_FIM_det.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_83_latent_mean(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_param_keys = 0;
  PyObject *__pyx_v_param_guess_range = 0;
  PyObject *__pyx_v_is_scale_parameter = 0;
  PyObject *__pyx_v_scaled_param_guesses = 0;
  PyObject *__pyx_v_param_length = 0;
  CYTHON_UNUSED PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_obs0 = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_v_init_flags = 0;
  PyObject *__pyx_v_init_fltrs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_latent_mean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_param_keys,&__pyx_n_s_param_guess_range,&__pyx_n_s_is_scale_parameter,&__pyx_n_s_scaled_param_guesses,&__pyx_n_s_param_length,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_obs0,&__pyx_n_s_inter_steps,&__pyx_n_s_init_flags,&__pyx_n_s_init_fltrs,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2454
 * 
 *     def _latent_mean(self, params, contactMatrix=None,
 *                       generator=None, intervention_fun=None,             # <<<<<<<<<<<<<<
 *               param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2455
 *     def _latent_mean(self, params, contactMatrix=None,
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,             # <<<<<<<<<<<<<<
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None, param_length=None,
 */
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2456
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,             # <<<<<<<<<<<<<<
 *                             scaled_param_guesses=None, param_length=None,
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2457
 *               param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None, param_length=None,             # <<<<<<<<<<<<<<
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 *                             inter_steps=None,
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2458
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None, param_length=None,
 *                             obs=None, fltr=None, Tf=None, obs0=None,             # <<<<<<<<<<<<<<
 *                             inter_steps=None,
 *                             init_flags=None, init_fltrs=None):
 */
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2459
 *                             scaled_param_guesses=None, param_length=None,
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 *                             inter_steps=None,             # <<<<<<<<<<<<<<
 *                             init_flags=None, init_fltrs=None):
 *         """Objective function for differentiation call in latent_FIM and latent_FIM_det."""
 */
    values[13] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2460
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 *                             inter_steps=None,
 *                             init_flags=None, init_fltrs=None):             # <<<<<<<<<<<<<<
 *         """Objective function for differentiation call in latent_FIM and latent_FIM_det."""
 *         param_estimates = np.copy(params[:param_length])
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_keys);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_guess_range);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_scale_parameter);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaled_param_guesses);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_length);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs0);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_flags);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_fltrs);
          if (value) { values[15] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_latent_mean") < 0)) __PYX_ERR(0, 2453, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_contactMatrix = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_intervention_fun = values[3];
    __pyx_v_param_keys = values[4];
    __pyx_v_param_guess_range = values[5];
    __pyx_v_is_scale_parameter = values[6];
    __pyx_v_scaled_param_guesses = values[7];
    __pyx_v_param_length = values[8];
    __pyx_v_obs = values[9];
    __pyx_v_fltr = values[10];
    __pyx_v_Tf = values[11];
    __pyx_v_obs0 = values[12];
    __pyx_v_inter_steps = values[13];
    __pyx_v_init_flags = values[14];
    __pyx_v_init_fltrs = values[15];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_latent_mean", 0, 1, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._latent_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_82_latent_mean(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_param_keys, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses, __pyx_v_param_length, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_obs0, __pyx_v_inter_steps, __pyx_v_init_flags, __pyx_v_init_fltrs);

  /* "pyross/inference.pyx":2453
 *         return output_samples
 * 
 *     def _latent_mean(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_82_latent_mean(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_param_length, CYTHON_UNUSED PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_obs0, PyObject *__pyx_v_inter_steps, PyObject *__pyx_v_init_flags, PyObject *__pyx_v_init_fltrs) {
  PyObject *__pyx_v_param_estimates = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_init_estimates = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_fltr_ = NULL;
  PyObject *__pyx_v_Nf = NULL;
  PyObject *__pyx_v_full_fltr = NULL;
  PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_v_xm = NULL;
  PyObject *__pyx_v_xm_red = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_latent_mean", 0);

  /* "pyross/inference.pyx":2462
 *                             init_flags=None, init_fltrs=None):
 *         """Objective function for differentiation call in latent_FIM and latent_FIM_det."""
 *         param_estimates = np.copy(params[:param_length])             # <<<<<<<<<<<<<<
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_params, 0, 0, NULL, &__pyx_v_param_length, NULL, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_param_estimates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2464
 *         param_estimates = np.copy(params[:param_length])
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,             # <<<<<<<<<<<<<<
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2467
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 *                                                       scaled_param_guesses)             # <<<<<<<<<<<<<<
 * 
 *         init_estimates =  np.copy(params[param_length:])
 */
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2464, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2464, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_param_estimates);
    __Pyx_GIVEREF(__pyx_v_param_estimates);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_param_estimates);
    __Pyx_INCREF(__pyx_v_param_guess_range);
    __Pyx_GIVEREF(__pyx_v_param_guess_range);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_param_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_param_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
    PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_5, __pyx_v_scaled_param_guesses);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_orig_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2469
 *                                                       scaled_param_guesses)
 * 
 *         init_estimates =  np.copy(params[param_length:])             # <<<<<<<<<<<<<<
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_params, 0, 0, &__pyx_v_param_length, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_init_estimates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2471
 *         init_estimates =  np.copy(params[param_length:])
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *         self.set_params(map_params_dict)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_param_keys);
  __Pyx_GIVEREF(__pyx_v_param_keys);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_param_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_orig_params);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 2471, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2471, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(0, 2471, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2471, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_map_params_dict = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_map_control_params_dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":2472
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 *         self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2474
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  __pyx_t_7 = (__pyx_v_generator != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":2475
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
    __pyx_t_8 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "pyross/inference.pyx":2476
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 2476, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_4 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2476, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2476, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pyross/inference.pyx":2475
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
      goto __pyx_L6;
    }

    /* "pyross/inference.pyx":2478
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         fltr_ = fltr[1:]
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 2478, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "pyross/inference.pyx":2474
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  }

  /* "pyross/inference.pyx":2480
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *         fltr_ = fltr[1:]             # <<<<<<<<<<<<<<
 *         Nf=fltr_.shape[0]+1
 *         full_fltr = sparse.block_diag(fltr_)
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_fltr, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fltr_ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2481
 * 
 *         fltr_ = fltr[1:]
 *         Nf=fltr_.shape[0]+1             # <<<<<<<<<<<<<<
 *         full_fltr = sparse.block_diag(fltr_)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fltr_, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_Nf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2482
 *         fltr_ = fltr[1:]
 *         Nf=fltr_.shape[0]+1
 *         full_fltr = sparse.block_diag(fltr_)             # <<<<<<<<<<<<<<
 * 
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sparse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_fltr_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fltr_);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_full_fltr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2484
 *         full_fltr = sparse.block_diag(fltr_)
 * 
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])             # <<<<<<<<<<<<<<
 * 
 *         if inter_steps:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fltr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_init_estimates, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2484, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_init_estimates, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2484, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_estimates);
    __Pyx_GIVEREF(__pyx_v_init_estimates);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, __pyx_v_init_estimates);
    __Pyx_INCREF(__pyx_v_init_flags);
    __Pyx_GIVEREF(__pyx_v_init_flags);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_v_init_flags);
    __Pyx_INCREF(__pyx_v_init_fltrs);
    __Pyx_GIVEREF(__pyx_v_init_fltrs);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_5, __pyx_v_init_fltrs);
    __Pyx_INCREF(__pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_v_obs0);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_5, __pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_5, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_x0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2486
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])
 * 
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_inter_steps); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2486, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":2487
 * 
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)             # <<<<<<<<<<<<<<
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 *             xm = xm[::inter_steps]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_multiply); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x0, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2487, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x0, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2487, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x0);
      __Pyx_GIVEREF(__pyx_v_x0);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_x0);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2488
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)             # <<<<<<<<<<<<<<
 *             xm = xm[::inter_steps]
 *             xm = np.divide(xm, self.Omega)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyross); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_forward_euler_integration); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rhs0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[7] = {__pyx_t_4, __pyx_t_3, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf, __pyx_v_inter_steps};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2488, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[7] = {__pyx_t_4, __pyx_t_3, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf, __pyx_v_inter_steps};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2488, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(6+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_x0);
      __Pyx_GIVEREF(__pyx_v_x0);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_x0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_5, __pyx_int_0);
      __Pyx_INCREF(__pyx_v_Tf);
      __Pyx_GIVEREF(__pyx_v_Tf);
      PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_5, __pyx_v_Tf);
      __Pyx_INCREF(__pyx_v_Nf);
      __Pyx_GIVEREF(__pyx_v_Nf);
      PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_5, __pyx_v_Nf);
      __Pyx_INCREF(__pyx_v_inter_steps);
      __Pyx_GIVEREF(__pyx_v_inter_steps);
      PyTuple_SET_ITEM(__pyx_t_2, 5+__pyx_t_5, __pyx_v_inter_steps);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_xm = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2489
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 *             xm = xm[::inter_steps]             # <<<<<<<<<<<<<<
 *             xm = np.divide(xm, self.Omega)
 *         else:
 */
    __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_v_inter_steps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_xm, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_xm, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":2490
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 *             xm = xm[::inter_steps]
 *             xm = np.divide(xm, self.Omega)             # <<<<<<<<<<<<<<
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_divide); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_xm, __pyx_t_1};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2490, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_xm, __pyx_t_1};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2490, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_xm);
      __Pyx_GIVEREF(__pyx_v_xm);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_xm);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_xm, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":2486
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])
 * 
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf, Nf, inter_steps)
 */
    goto __pyx_L7;
  }

  /* "pyross/inference.pyx":2492
 *             xm = np.divide(xm, self.Omega)
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)             # <<<<<<<<<<<<<<
 *         xm_red = full_fltr@(np.ravel(xm[1:]))
 *         return xm_red
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_integrate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2492, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_x0, __pyx_int_0, __pyx_v_Tf, __pyx_v_Nf};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2492, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x0);
      __Pyx_GIVEREF(__pyx_v_x0);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_v_x0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_int_0);
      __Pyx_INCREF(__pyx_v_Tf);
      __Pyx_GIVEREF(__pyx_v_Tf);
      PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_5, __pyx_v_Tf);
      __Pyx_INCREF(__pyx_v_Nf);
      __Pyx_GIVEREF(__pyx_v_Nf);
      PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_5, __pyx_v_Nf);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_xm = __pyx_t_9;
    __pyx_t_9 = 0;
  }
  __pyx_L7:;

  /* "pyross/inference.pyx":2493
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)
 *         xm_red = full_fltr@(np.ravel(xm[1:]))             # <<<<<<<<<<<<<<
 *         return xm_red
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ravel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_xm, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_9 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_xm_red = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2494
 *             xm = self.integrate(x0, 0, Tf, Nf)
 *         xm_red = full_fltr@(np.ravel(xm[1:]))
 *         return xm_red             # <<<<<<<<<<<<<<
 * 
 *     def _latent_cov(self, params, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_xm_red);
  __pyx_r = __pyx_v_xm_red;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2453
 *         return output_samples
 * 
 *     def _latent_mean(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                       generator=None, intervention_fun=None,
 *               param_keys=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SIR_type._latent_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_estimates);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_init_estimates);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_fltr_);
  __Pyx_XDECREF(__pyx_v_Nf);
  __Pyx_XDECREF(__pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_xm);
  __Pyx_XDECREF(__pyx_v_xm_red);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2496
 *         return xm_red
 * 
 *     def _latent_cov(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_85_latent_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_84_latent_cov[] = "Objective function for differentiation call in latent_FIM.";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_85_latent_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_params = 0;
  CYTHON_UNUSED PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_param_keys = 0;
  PyObject *__pyx_v_param_guess_range = 0;
  PyObject *__pyx_v_is_scale_parameter = 0;
  PyObject *__pyx_v_scaled_param_guesses = 0;
  PyObject *__pyx_v_param_length = 0;
  CYTHON_UNUSED PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_obs0 = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_v_init_flags = 0;
  PyObject *__pyx_v_init_fltrs = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_latent_cov (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_param_keys,&__pyx_n_s_param_guess_range,&__pyx_n_s_is_scale_parameter,&__pyx_n_s_scaled_param_guesses,&__pyx_n_s_param_length,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_obs0,&__pyx_n_s_inter_steps,&__pyx_n_s_init_flags,&__pyx_n_s_init_fltrs,&__pyx_n_s_tangent,0};
    PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2497
 * 
 *     def _latent_cov(self, params, contactMatrix=None,
 *              generator=None, intervention_fun=None,             # <<<<<<<<<<<<<<
 *              param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2498
 *     def _latent_cov(self, params, contactMatrix=None,
 *              generator=None, intervention_fun=None,
 *              param_keys=None,             # <<<<<<<<<<<<<<
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None, param_length=None,
 */
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2499
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,             # <<<<<<<<<<<<<<
 *                             scaled_param_guesses=None, param_length=None,
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2500
 *              param_keys=None,
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None, param_length=None,             # <<<<<<<<<<<<<<
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 *                             inter_steps=None,
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2501
 *                             param_guess_range=None, is_scale_parameter=None,
 *                             scaled_param_guesses=None, param_length=None,
 *                             obs=None, fltr=None, Tf=None, obs0=None,             # <<<<<<<<<<<<<<
 *                             inter_steps=None,
 *                             init_flags=None, init_fltrs=None, tangent=False):
 */
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2502
 *                             scaled_param_guesses=None, param_length=None,
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 *                             inter_steps=None,             # <<<<<<<<<<<<<<
 *                             init_flags=None, init_fltrs=None, tangent=False):
 *         """Objective function for differentiation call in latent_FIM."""
 */
    values[13] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2503
 *                             obs=None, fltr=None, Tf=None, obs0=None,
 *                             inter_steps=None,
 *                             init_flags=None, init_fltrs=None, tangent=False):             # <<<<<<<<<<<<<<
 *         """Objective function for differentiation call in latent_FIM."""
 *         param_estimates = np.copy(params[:param_length])
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = ((PyObject *)Py_None);
    values[16] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_keys);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_guess_range);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_scale_parameter);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaled_param_guesses);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_length);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs0);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_flags);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_fltrs);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[16] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_latent_cov") < 0)) __PYX_ERR(0, 2496, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_params = values[0];
    __pyx_v_contactMatrix = values[1];
    __pyx_v_generator = values[2];
    __pyx_v_intervention_fun = values[3];
    __pyx_v_param_keys = values[4];
    __pyx_v_param_guess_range = values[5];
    __pyx_v_is_scale_parameter = values[6];
    __pyx_v_scaled_param_guesses = values[7];
    __pyx_v_param_length = values[8];
    __pyx_v_obs = values[9];
    __pyx_v_fltr = values[10];
    __pyx_v_Tf = values[11];
    __pyx_v_obs0 = values[12];
    __pyx_v_inter_steps = values[13];
    __pyx_v_init_flags = values[14];
    __pyx_v_init_fltrs = values[15];
    __pyx_v_tangent = values[16];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_latent_cov", 0, 1, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._latent_cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_84_latent_cov(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_params, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_param_keys, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses, __pyx_v_param_length, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_obs0, __pyx_v_inter_steps, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_tangent);

  /* "pyross/inference.pyx":2496
 *         return xm_red
 * 
 *     def _latent_cov(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_84_latent_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_params, CYTHON_UNUSED PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_param_keys, PyObject *__pyx_v_param_guess_range, PyObject *__pyx_v_is_scale_parameter, PyObject *__pyx_v_scaled_param_guesses, PyObject *__pyx_v_param_length, CYTHON_UNUSED PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_obs0, PyObject *__pyx_v_inter_steps, PyObject *__pyx_v_init_flags, PyObject *__pyx_v_init_fltrs, PyObject *__pyx_v_tangent) {
  PyObject *__pyx_v_param_estimates = NULL;
  PyObject *__pyx_v_orig_params = NULL;
  PyObject *__pyx_v_init_estimates = NULL;
  PyObject *__pyx_v_map_params_dict = NULL;
  PyObject *__pyx_v_map_control_params_dict = NULL;
  PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_v_fltr_ = NULL;
  PyObject *__pyx_v_Nf = NULL;
  PyObject *__pyx_v_full_fltr = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_xm = NULL;
  PyObject *__pyx_v_full_cov = NULL;
  PyObject *__pyx_v_cov_red = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space __pyx_t_14;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov __pyx_t_15;
  __Pyx_RefNannySetupContext("_latent_cov", 0);

  /* "pyross/inference.pyx":2505
 *                             init_flags=None, init_fltrs=None, tangent=False):
 *         """Objective function for differentiation call in latent_FIM."""
 *         param_estimates = np.copy(params[:param_length])             # <<<<<<<<<<<<<<
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_params, 0, 0, NULL, &__pyx_v_param_length, NULL, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_param_estimates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2507
 *         param_estimates = np.copy(params[:param_length])
 * 
 *         orig_params = pyross.utils.unflatten_parameters(param_estimates,             # <<<<<<<<<<<<<<
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2510
 *                                                       param_guess_range,
 *                                                       is_scale_parameter,
 *                                                       scaled_param_guesses)             # <<<<<<<<<<<<<<
 * 
 *         init_estimates =  np.copy(params[param_length:])
 */
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2507, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_param_estimates, __pyx_v_param_guess_range, __pyx_v_is_scale_parameter, __pyx_v_scaled_param_guesses};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2507, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_param_estimates);
    __Pyx_GIVEREF(__pyx_v_param_estimates);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_param_estimates);
    __Pyx_INCREF(__pyx_v_param_guess_range);
    __Pyx_GIVEREF(__pyx_v_param_guess_range);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_param_guess_range);
    __Pyx_INCREF(__pyx_v_is_scale_parameter);
    __Pyx_GIVEREF(__pyx_v_is_scale_parameter);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_is_scale_parameter);
    __Pyx_INCREF(__pyx_v_scaled_param_guesses);
    __Pyx_GIVEREF(__pyx_v_scaled_param_guesses);
    PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_5, __pyx_v_scaled_param_guesses);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_orig_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2512
 *                                                       scaled_param_guesses)
 * 
 *         init_estimates =  np.copy(params[param_length:])             # <<<<<<<<<<<<<<
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_params, 0, 0, &__pyx_v_param_length, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_init_estimates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2514
 *         init_estimates =  np.copy(params[param_length:])
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)             # <<<<<<<<<<<<<<
 *         self.set_params(map_params_dict)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_params_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_param_keys);
  __Pyx_GIVEREF(__pyx_v_param_keys);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_param_keys);
  __Pyx_INCREF(__pyx_v_orig_params);
  __Pyx_GIVEREF(__pyx_v_orig_params);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_orig_params);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return_additional_params, Py_True) < 0) __PYX_ERR(0, 2514, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2514, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(0, 2514, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2514, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_map_params_dict = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_map_control_params_dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":2515
 * 
 *         map_params_dict, map_control_params_dict = self.fill_params_dict(param_keys, orig_params, return_additional_params=True)
 *         self.set_params(map_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         if generator is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_map_params_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2517
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  __pyx_t_7 = (__pyx_v_generator != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":2518
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
    __pyx_t_8 = (__pyx_v_intervention_fun == Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "pyross/inference.pyx":2519
 *         if generator is not None:
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_constant_contactMatrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 2519, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_4 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2519, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2519, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pyross/inference.pyx":2518
 * 
 *         if generator is not None:
 *             if intervention_fun is None:             # <<<<<<<<<<<<<<
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 */
      goto __pyx_L6;
    }

    /* "pyross/inference.pyx":2521
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 *             else:
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)             # <<<<<<<<<<<<<<
 * 
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_generator, __pyx_n_s_intervention_custom_temporal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_intervention_fun);
      __Pyx_GIVEREF(__pyx_v_intervention_fun);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_intervention_fun);
      if (unlikely(__pyx_v_map_control_params_dict == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 2521, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_map_control_params_dict))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_map_control_params_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_map_control_params_dict, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->contactMatrix);
      __Pyx_DECREF(__pyx_v_self->contactMatrix);
      __pyx_v_self->contactMatrix = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "pyross/inference.pyx":2517
 *         self.set_params(map_params_dict)
 * 
 *         if generator is not None:             # <<<<<<<<<<<<<<
 *             if intervention_fun is None:
 *                 self.contactMatrix = generator.constant_contactMatrix(**map_control_params_dict)
 */
  }

  /* "pyross/inference.pyx":2523
 *                 self.contactMatrix = generator.intervention_custom_temporal(intervention_fun, **map_control_params_dict)
 * 
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])             # <<<<<<<<<<<<<<
 *         fltr_ = fltr[1:]
 *         Nf=fltr_.shape[0]+1
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_fltr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_init_estimates, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2523, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_init_estimates, __pyx_v_init_flags, __pyx_v_init_fltrs, __pyx_v_obs0, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2523, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_estimates);
    __Pyx_GIVEREF(__pyx_v_init_estimates);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, __pyx_v_init_estimates);
    __Pyx_INCREF(__pyx_v_init_flags);
    __Pyx_GIVEREF(__pyx_v_init_flags);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_v_init_flags);
    __Pyx_INCREF(__pyx_v_init_fltrs);
    __Pyx_GIVEREF(__pyx_v_init_fltrs);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_5, __pyx_v_init_fltrs);
    __Pyx_INCREF(__pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_v_obs0);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_5, __pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_5, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_x0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2524
 * 
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])
 *         fltr_ = fltr[1:]             # <<<<<<<<<<<<<<
 *         Nf=fltr_.shape[0]+1
 *         full_fltr = sparse.block_diag(fltr_)
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_fltr, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fltr_ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2525
 *         x0 = self._construct_inits(init_estimates, init_flags, init_fltrs, obs0, fltr[0])
 *         fltr_ = fltr[1:]
 *         Nf=fltr_.shape[0]+1             # <<<<<<<<<<<<<<
 *         full_fltr = sparse.block_diag(fltr_)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fltr_, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_Nf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2526
 *         fltr_ = fltr[1:]
 *         Nf=fltr_.shape[0]+1
 *         full_fltr = sparse.block_diag(fltr_)             # <<<<<<<<<<<<<<
 * 
 *         if tangent:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sparse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_2, __pyx_v_fltr_) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_fltr_);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_full_fltr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2528
 *         full_fltr = sparse.block_diag(fltr_)
 * 
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,
 *                                                                   inter_steps)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2528, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":2529
 * 
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,             # <<<<<<<<<<<<<<
 *                                                                   inter_steps)
 *         else:
 */
    __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_x0, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 2529, __pyx_L1_error)
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2529, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_Nf); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2529, __pyx_L1_error)

    /* "pyross/inference.pyx":2530
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,
 *                                                                   inter_steps)             # <<<<<<<<<<<<<<
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps)
 */
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_inter_steps); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2530, __pyx_L1_error)

    /* "pyross/inference.pyx":2529
 * 
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,             # <<<<<<<<<<<<<<
 *                                                                   inter_steps)
 *         else:
 */
    __pyx_t_14.__pyx_n = 1;
    __pyx_t_14.inter_steps = __pyx_t_13;
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov_tangent_space(__pyx_v_self, __pyx_t_10, __pyx_t_11, __pyx_t_12, 0, &__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
    __pyx_t_10.memview = NULL;
    __pyx_t_10.data = NULL;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2529, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2529, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2529, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_full_cov = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":2528
 *         full_fltr = sparse.block_diag(fltr_)
 * 
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf,
 *                                                                   inter_steps)
 */
    goto __pyx_L7;
  }

  /* "pyross/inference.pyx":2532
 *                                                                   inter_steps)
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps)             # <<<<<<<<<<<<<<
 * 
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)
 */
  /*else*/ {
    __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_x0, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 2532, __pyx_L1_error)
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_Tf); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2532, __pyx_L1_error)
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_Nf); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2532, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_inter_steps); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2532, __pyx_L1_error)
    __pyx_t_15.__pyx_n = 1;
    __pyx_t_15.inter_steps = __pyx_t_12;
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov(__pyx_v_self, __pyx_t_10, __pyx_t_11, __pyx_t_13, 0, &__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
    __pyx_t_10.memview = NULL;
    __pyx_t_10.data = NULL;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2532, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_9 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2532, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2532, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_full_cov = __pyx_t_9;
    __pyx_t_9 = 0;
  }
  __pyx_L7:;

  /* "pyross/inference.pyx":2534
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps)
 * 
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)             # <<<<<<<<<<<<<<
 *         return cov_red
 * 
 */
  __pyx_t_1 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, __pyx_v_full_cov); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_transpose); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_9 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_full_fltr) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_cov_red = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":2535
 * 
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)
 *         return cov_red             # <<<<<<<<<<<<<<
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cov_red);
  __pyx_r = __pyx_v_cov_red;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2496
 *         return xm_red
 * 
 *     def _latent_cov(self, params, contactMatrix=None,             # <<<<<<<<<<<<<<
 *              generator=None, intervention_fun=None,
 *              param_keys=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._latent_cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_estimates);
  __Pyx_XDECREF(__pyx_v_orig_params);
  __Pyx_XDECREF(__pyx_v_init_estimates);
  __Pyx_XDECREF(__pyx_v_map_params_dict);
  __Pyx_XDECREF(__pyx_v_map_control_params_dict);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_fltr_);
  __Pyx_XDECREF(__pyx_v_Nf);
  __Pyx_XDECREF(__pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_v_xm);
  __Pyx_XDECREF(__pyx_v_full_cov);
  __Pyx_XDECREF(__pyx_v_cov_red);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2537
 *         return cov_red
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                    generator=None,
 *                    intervention_fun=None, tangent=False, eps=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_87latent_FIM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_86latent_FIM[] = "\n        Computes the Fisher Information Matrix (FIM) of the stochastic model for the initial conditions and all desired parameters, including control parameters, for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        eps: float or numpy.array, optional\n            Step size for numerical differentiation of the process mean and its full covariance matrix with respect to the parameters. Must be eith""er a scalar, or an array of length `len(infer_result['flat_params'])`. If not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_likelihood']),infer_result['log_likelihood'])**(0.25)` is used. It is recommended to use a step-size greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        inter_steps: int, optional\n            Intermediate steps between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 100.\n        Returns\n        -------\n        FIM: 2d numpy.array\n            The Fisher Information Matrix\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_87latent_FIM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_FIM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_eps,&__pyx_n_s_inter_steps,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2538
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 *                    generator=None,             # <<<<<<<<<<<<<<
 *                    intervention_fun=None, tangent=False, eps=None,
 *                    inter_steps=100):
 */
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2539
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 *                    generator=None,
 *                    intervention_fun=None, tangent=False, eps=None,             # <<<<<<<<<<<<<<
 *                    inter_steps=100):
 *         '''
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_FIM", 0, 4, 10, 1); __PYX_ERR(0, 2537, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_FIM", 0, 4, 10, 2); __PYX_ERR(0, 2537, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_FIM", 0, 4, 10, 3); __PYX_ERR(0, 2537, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "latent_FIM") < 0)) __PYX_ERR(0, 2537, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_infer_result = values[3];
    __pyx_v_contactMatrix = values[4];
    __pyx_v_generator = values[5];
    __pyx_v_intervention_fun = values[6];
    __pyx_v_tangent = values[7];
    __pyx_v_eps = values[8];
    __pyx_v_inter_steps = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_FIM", 0, 4, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2537, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_86latent_FIM(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":2537
 *         return cov_red
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                    generator=None,
 *                    intervention_fun=None, tangent=False, eps=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2599
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10latent_FIM_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_10latent_FIM_1mean = {"mean", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_10latent_FIM_1mean, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10latent_FIM_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mean (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_mean(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mean", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":2600
 * 
 *         def mean(y):
 *             return self._latent_mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2600, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_latent_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_contactMatrix)) { __Pyx_RaiseClosureNameError("contactMatrix"); __PYX_ERR(0, 2600, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_cur_scope->__pyx_v_contactMatrix) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)

  /* "pyross/inference.pyx":2601
 *         def mean(y):
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,             # <<<<<<<<<<<<<<
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_generator)) { __Pyx_RaiseClosureNameError("generator"); __PYX_ERR(0, 2601, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_cur_scope->__pyx_v_generator) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)

  /* "pyross/inference.pyx":2602
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,             # <<<<<<<<<<<<<<
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 *                               inter_steps=inter_steps,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_intervention_fun)) { __Pyx_RaiseClosureNameError("intervention_fun"); __PYX_ERR(0, 2602, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, __pyx_cur_scope->__pyx_v_intervention_fun) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs)) { __Pyx_RaiseClosureNameError("obs"); __PYX_ERR(0, 2602, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs, __pyx_cur_scope->__pyx_v_obs) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)

  /* "pyross/inference.pyx":2603
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0,             # <<<<<<<<<<<<<<
 *                               inter_steps=inter_steps,
 *                               **kwargs)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_fltr)) { __Pyx_RaiseClosureNameError("fltr"); __PYX_ERR(0, 2603, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fltr, __pyx_cur_scope->__pyx_v_fltr) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 2603, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs0)) { __Pyx_RaiseClosureNameError("obs0"); __PYX_ERR(0, 2603, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs0, __pyx_cur_scope->__pyx_v_obs0) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)

  /* "pyross/inference.pyx":2604
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 *                               inter_steps=inter_steps,             # <<<<<<<<<<<<<<
 *                               **kwargs)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_inter_steps)) { __Pyx_RaiseClosureNameError("inter_steps"); __PYX_ERR(0, 2604, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inter_steps, __pyx_cur_scope->__pyx_v_inter_steps) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":2605
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 *                               inter_steps=inter_steps,
 *                               **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         def covariance(y):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 2605, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 2605, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 2605, __pyx_L1_error)

  /* "pyross/inference.pyx":2600
 * 
 *         def mean(y):
 *             return self._latent_mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2599
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2607
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._latent_cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10latent_FIM_3covariance(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_10latent_FIM_3covariance = {"covariance", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_10latent_FIM_3covariance, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10latent_FIM_3covariance(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("covariance (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_2covariance(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_2covariance(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("covariance", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":2608
 * 
 *         def covariance(y):
 *             return self._latent_cov(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2608, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_latent_cov); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_contactMatrix)) { __Pyx_RaiseClosureNameError("contactMatrix"); __PYX_ERR(0, 2608, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_cur_scope->__pyx_v_contactMatrix) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)

  /* "pyross/inference.pyx":2609
 *         def covariance(y):
 *             return self._latent_cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,             # <<<<<<<<<<<<<<
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0, tangent=tangent,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_generator)) { __Pyx_RaiseClosureNameError("generator"); __PYX_ERR(0, 2609, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_cur_scope->__pyx_v_generator) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)

  /* "pyross/inference.pyx":2610
 *             return self._latent_cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,             # <<<<<<<<<<<<<<
 *                               fltr=fltr, Tf=Tf, obs0=obs0, tangent=tangent,
 *                               inter_steps=inter_steps,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_intervention_fun)) { __Pyx_RaiseClosureNameError("intervention_fun"); __PYX_ERR(0, 2610, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, __pyx_cur_scope->__pyx_v_intervention_fun) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs)) { __Pyx_RaiseClosureNameError("obs"); __PYX_ERR(0, 2610, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs, __pyx_cur_scope->__pyx_v_obs) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)

  /* "pyross/inference.pyx":2611
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0, tangent=tangent,             # <<<<<<<<<<<<<<
 *                               inter_steps=inter_steps,
 *                               **kwargs)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_fltr)) { __Pyx_RaiseClosureNameError("fltr"); __PYX_ERR(0, 2611, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fltr, __pyx_cur_scope->__pyx_v_fltr) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 2611, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs0)) { __Pyx_RaiseClosureNameError("obs0"); __PYX_ERR(0, 2611, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs0, __pyx_cur_scope->__pyx_v_obs0) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_tangent)) { __Pyx_RaiseClosureNameError("tangent"); __PYX_ERR(0, 2611, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tangent, __pyx_cur_scope->__pyx_v_tangent) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)

  /* "pyross/inference.pyx":2612
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0, tangent=tangent,
 *                               inter_steps=inter_steps,             # <<<<<<<<<<<<<<
 *                               **kwargs)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_inter_steps)) { __Pyx_RaiseClosureNameError("inter_steps"); __PYX_ERR(0, 2612, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inter_steps, __pyx_cur_scope->__pyx_v_inter_steps) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":2613
 *                               fltr=fltr, Tf=Tf, obs0=obs0, tangent=tangent,
 *                               inter_steps=inter_steps,
 *                               **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if np.all(eps == None):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 2613, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 2613, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 2613, __pyx_L1_error)

  /* "pyross/inference.pyx":2608
 * 
 *         def covariance(y):
 *             return self._latent_cov(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                      generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2607
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._latent_cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM.covariance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2537
 *         return cov_red
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                    generator=None,
 *                    intervention_fun=None, tangent=False, eps=None,
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_86latent_FIM(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_inter_steps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *__pyx_cur_scope;
  PyObject *__pyx_v_infer_result_loc = NULL;
  PyObject *__pyx_v_flat_params = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_mean = 0;
  PyObject *__pyx_v_covariance = 0;
  PyObject *__pyx_v_xx = NULL;
  PyObject *__pyx_v_fx = NULL;
  PyObject *__pyx_v_cov = NULL;
  PyObject *__pyx_v_invcov = NULL;
  Py_ssize_t __pyx_v_dim;
  PyObject *__pyx_v_FIM = NULL;
  PyObject *__pyx_v_dmu = NULL;
  PyObject *__pyx_v_dcov = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_t1 = NULL;
  PyObject *__pyx_v_t2 = NULL;
  PyObject *__pyx_v_rows = NULL;
  PyObject *__pyx_v_cols = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_i_lower = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("latent_FIM", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_4_latent_FIM(__pyx_ptype_6pyross_9inference___pyx_scope_struct_4_latent_FIM, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2537, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_obs = __pyx_v_obs;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_obs);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_obs);
  __pyx_cur_scope->__pyx_v_fltr = __pyx_v_fltr;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fltr);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fltr);
  __pyx_cur_scope->__pyx_v_Tf = __pyx_v_Tf;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Tf);
  __pyx_cur_scope->__pyx_v_contactMatrix = __pyx_v_contactMatrix;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __pyx_cur_scope->__pyx_v_generator = __pyx_v_generator;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
  __pyx_cur_scope->__pyx_v_intervention_fun = __pyx_v_intervention_fun;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __pyx_cur_scope->__pyx_v_tangent = __pyx_v_tangent;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tangent);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tangent);
  __pyx_cur_scope->__pyx_v_inter_steps = __pyx_v_inter_steps;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_INCREF(__pyx_v_eps);

  /* "pyross/inference.pyx":2581
 *         '''
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_generator);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_cur_scope->__pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2584
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         infer_result_loc = infer_result.copy()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_fltr, __pyx_cur_scope->__pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_fltr, __pyx_cur_scope->__pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_fltr);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2584, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 2584, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2584, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_fltr);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_fltr, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_obs);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_obs, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_cur_scope->__pyx_v_obs0 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2586
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)
 * 
 *         infer_result_loc = infer_result.copy()             # <<<<<<<<<<<<<<
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_infer_result_loc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2588
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_flat_map, __pyx_v_infer_result_loc, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2588, __pyx_L1_error)
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2589
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')             # <<<<<<<<<<<<<<
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result_loc, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_n_u_flat_map) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_flat_map);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params, __pyx_t_1) < 0)) __PYX_ERR(0, 2589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2588
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  }

  /* "pyross/inference.pyx":2591
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])             # <<<<<<<<<<<<<<
 * 
 *         kwargs = {}
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_flat_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2593
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 * 
 *         kwargs = {}             # <<<<<<<<<<<<<<
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2594
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 */
  __pyx_t_1 = __pyx_tuple__23; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
  for (;;) {
    if (__pyx_t_10 >= 7) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2594, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2597
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 *             kwargs[key] = infer_result_loc[key]             # <<<<<<<<<<<<<<
 * 
 *         def mean(y):
 */
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_v_key, __pyx_t_3) < 0)) __PYX_ERR(0, 2597, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2594
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2599
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_10latent_FIM_1mean, 0, __pyx_n_s_latent_FIM_locals_mean, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mean = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2607
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._latent_cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_10latent_FIM_3covariance, 0, __pyx_n_s_latent_FIM_locals_covariance, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_covariance = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2615
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_eps, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2616
 * 
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']             # <<<<<<<<<<<<<<
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_xx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2617
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])             # <<<<<<<<<<<<<<
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_log_likelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2618
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)             # <<<<<<<<<<<<<<
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_100, __pyx_v_xx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_divide); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_spacing); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_6, __pyx_v_fx) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_fx);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_3, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2618, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_3, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2618, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_fx);
      __Pyx_GIVEREF(__pyx_v_fx);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_fx);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_float_0_25, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2615
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
    goto __pyx_L8;
  }

  /* "pyross/inference.pyx":2620
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isscalar); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_eps) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_eps);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2620, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2621
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))             # <<<<<<<<<<<<<<
 *         print('eps-vector used for differentiation: ', eps)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_repeat); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_eps);
    __Pyx_GIVEREF(__pyx_v_eps);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_eps);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2621, __pyx_L1_error)
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_repeats, __pyx_t_6) < 0) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":2620
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  }
  __pyx_L8:;

  /* "pyross/inference.pyx":2622
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)             # <<<<<<<<<<<<<<
 * 
 *         cov = covariance(flat_params)
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_GIVEREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_eps);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2624
 *         print('eps-vector used for differentiation: ', eps)
 * 
 *         cov = covariance(flat_params)             # <<<<<<<<<<<<<<
 *         invcov = np.linalg.inv(cov)
 * 
 */
  __pyx_t_2 = __pyx_pf_6pyross_9inference_8SIR_type_10latent_FIM_2covariance(__pyx_v_covariance, __pyx_v_flat_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_cov = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2625
 * 
 *         cov = covariance(flat_params)
 *         invcov = np.linalg.inv(cov)             # <<<<<<<<<<<<<<
 * 
 *         dim = len(flat_params)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_linalg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_v_cov) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_cov);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_invcov = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2627
 *         invcov = np.linalg.inv(cov)
 * 
 *         dim = len(flat_params)             # <<<<<<<<<<<<<<
 *         FIM = np.empty((dim,dim))
 *         dmu = []
 */
  __pyx_t_10 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2627, __pyx_L1_error)
  __pyx_v_dim = __pyx_t_10;

  /* "pyross/inference.pyx":2628
 * 
 *         dim = len(flat_params)
 *         FIM = np.empty((dim,dim))             # <<<<<<<<<<<<<<
 *         dmu = []
 *         dcov = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_FIM = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2629
 *         dim = len(flat_params)
 *         FIM = np.empty((dim,dim))
 *         dmu = []             # <<<<<<<<<<<<<<
 *         dcov = []
 * 
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_dmu = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2630
 *         FIM = np.empty((dim,dim))
 *         dmu = []
 *         dcov = []             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_dcov = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2632
 *         dcov = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 */
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2632, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2632, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2632, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2632, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2632, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_12(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2632, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2633
 * 
 *         for i in range(dim):
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))             # <<<<<<<<<<<<<<
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_partial_derivative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mean);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_var, __pyx_v_i) < 0) __PYX_ERR(0, 2633, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_point, __pyx_v_flat_params) < 0) __PYX_ERR(0, 2633, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_eps, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dx, __pyx_t_6) < 0) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dmu, __pyx_t_6); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 2633, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pyross/inference.pyx":2634
 *         for i in range(dim):
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyross); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_partial_derivative); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_covariance);
    __Pyx_GIVEREF(__pyx_v_covariance);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_covariance);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_var, __pyx_v_i) < 0) __PYX_ERR(0, 2634, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_point, __pyx_v_flat_params) < 0) __PYX_ERR(0, 2634, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_eps, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dx, __pyx_t_1) < 0) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dcov, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 2634, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2632
 *         dcov = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2636
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 */
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2636, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2636, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2636, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2636, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2636, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_12(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2636, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2637
 * 
 *         for i in range(dim):
 *             t1 = dmu[i]@invcov@dmu[i]             # <<<<<<<<<<<<<<
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 *             FIM[i,i] = t1 + t2
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_v_invcov); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2638
 *         for i in range(dim):
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))             # <<<<<<<<<<<<<<
 *             FIM[i,i] = t1 + t2
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_trace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_14 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_invcov, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_14, __pyx_v_invcov); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_i); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_6, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_14, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_15);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2638, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2638, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_float_0_5);
      PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_4, __pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_4, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2639
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 *             FIM[i,i] = t1 + t2             # <<<<<<<<<<<<<<
 * 
 *         rows,cols = np.triu_indices(dim,1)
 */
    __pyx_t_5 = PyNumber_Add(__pyx_v_t1, __pyx_v_t2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM, __pyx_t_3, __pyx_t_5) < 0)) __PYX_ERR(0, 2639, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2636
 *             dcov.append(pyross.utils.partial_derivative(covariance,  var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[i]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[i]))
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2641
 *             FIM[i,i] = t1 + t2
 * 
 *         rows,cols = np.triu_indices(dim,1)             # <<<<<<<<<<<<<<
 * 
 *         for i,j in zip(rows,cols):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_triu_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_15)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_5, __pyx_int_1};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_5, __pyx_int_1};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_15) {
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15); __pyx_t_15 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_t_5);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_1);
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2641, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L13_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L13_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(0, 2641, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L14_unpacking_done;
    __pyx_L13_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2641, __pyx_L1_error)
    __pyx_L14_unpacking_done:;
  }
  __pyx_v_rows = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_cols = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2643
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_rows);
  __Pyx_GIVEREF(__pyx_v_rows);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_rows);
  __Pyx_INCREF(__pyx_v_cols);
  __Pyx_GIVEREF(__pyx_v_cols);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_cols);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2643, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2643, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2643, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2643, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2643, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_12(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2643, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2643, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_15); if (unlikely(!__pyx_t_3)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_15), 2) < 0) __PYX_ERR(0, 2643, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2643, __pyx_L1_error)
      __pyx_L18_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2644
 * 
 *         for i,j in zip(rows,cols):
 *             t1 = dmu[i]@invcov@dmu[j]             # <<<<<<<<<<<<<<
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 *             FIM[i,j] = t1 + t2
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_v_invcov); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2645
 *         for i,j in zip(rows,cols):
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))             # <<<<<<<<<<<<<<
 *             FIM[i,j] = t1 + t2
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiply); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_trace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_i); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_14 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_invcov, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_14, __pyx_v_invcov); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_dcov, __pyx_v_j); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_6 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_14, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2645, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_float_0_5, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2645, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2645, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_float_0_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_float_0_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2645, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2646
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 *             FIM[i,j] = t1 + t2             # <<<<<<<<<<<<<<
 * 
 *         i_lower = np.tril_indices(dim,-1)
 */
    __pyx_t_3 = PyNumber_Add(__pyx_v_t1, __pyx_v_t2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 2646, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2643
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             t1 = dmu[i]@invcov@dmu[j]
 *             t2 = np.multiply(0.5,np.trace(invcov@dcov[i]@invcov@dcov[j]))
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2648
 *             FIM[i,j] = t1 + t2
 * 
 *         i_lower = np.tril_indices(dim,-1)             # <<<<<<<<<<<<<<
 *         FIM[i_lower] = FIM.T[i_lower]
 *         return FIM
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tril_indices); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_int_neg_1};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_int_neg_1};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_t_3);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_int_neg_1);
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_i_lower = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2649
 * 
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM[i_lower] = FIM.T[i_lower]             # <<<<<<<<<<<<<<
 *         return FIM
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_FIM, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_i_lower); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_FIM, __pyx_v_i_lower, __pyx_t_5) < 0)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2650
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM[i_lower] = FIM.T[i_lower]
 *         return FIM             # <<<<<<<<<<<<<<
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_FIM);
  __pyx_r = __pyx_v_FIM;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2537
 *         return cov_red
 * 
 *     def latent_FIM(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                    generator=None,
 *                    intervention_fun=None, tangent=False, eps=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_infer_result_loc);
  __Pyx_XDECREF(__pyx_v_flat_params);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_covariance);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_fx);
  __Pyx_XDECREF(__pyx_v_cov);
  __Pyx_XDECREF(__pyx_v_invcov);
  __Pyx_XDECREF(__pyx_v_FIM);
  __Pyx_XDECREF(__pyx_v_dmu);
  __Pyx_XDECREF(__pyx_v_dcov);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_t1);
  __Pyx_XDECREF(__pyx_v_t2);
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_i_lower);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2652
 *         return FIM
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,             # <<<<<<<<<<<<<<
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_89latent_FIM_det(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_88latent_FIM_det[] = "\n        Computes the Fisher Information Matrix (FIM) of the deterministic model (ODE based, including a constant measurement error) for the initial conditions and all desired parameters, including control parameters, for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        eps: float or numpy.array, optional\n            Step size for numerical differentiation of the process mean and its full covariance matrix with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result[""'flat_params'])`. If not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_likelihood']),infer_result['log_likelihood'])**(0.25)` is used. It is recommended to use a step-size greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        measurement_error: float, optional\n            Standard deviation of measurements (uniform and independent Gaussian measurement error assumed). Default is 1e-2.\n        inter_steps: int, optional\n            Intermediate steps between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting inter_steps=0 will fall back to the method accessible via det_method for the deterministic integration. We have found that forward Euler is generally slower, but more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 100.\n        Returns\n        -------\n        FIM_det: 2d numpy.array\n            The Fisher Information Matrix\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_89latent_FIM_det(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_measurement_error = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_FIM_det (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_eps,&__pyx_n_s_measurement_error,&__pyx_n_s_inter_steps,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":2653
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,
 *                        contactMatrix=None, generator=None,             # <<<<<<<<<<<<<<
 *                        intervention_fun=None,
 *                        eps=None, measurement_error=1e-2, inter_steps=100):
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2654
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,             # <<<<<<<<<<<<<<
 *                        eps=None, measurement_error=1e-2, inter_steps=100):
 *         '''
 */
    values[6] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2655
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,
 *                        eps=None, measurement_error=1e-2, inter_steps=100):             # <<<<<<<<<<<<<<
 *         '''
 *         Computes the Fisher Information Matrix (FIM) of the deterministic model (ODE based, including a constant measurement error) for the initial conditions and all desired parameters, including control parameters, for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)__pyx_float_1eneg_2);
    values[9] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_FIM_det", 0, 4, 10, 1); __PYX_ERR(0, 2652, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_FIM_det", 0, 4, 10, 2); __PYX_ERR(0, 2652, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_FIM_det", 0, 4, 10, 3); __PYX_ERR(0, 2652, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_measurement_error);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "latent_FIM_det") < 0)) __PYX_ERR(0, 2652, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_infer_result = values[3];
    __pyx_v_contactMatrix = values[4];
    __pyx_v_generator = values[5];
    __pyx_v_intervention_fun = values[6];
    __pyx_v_eps = values[7];
    __pyx_v_measurement_error = values[8];
    __pyx_v_inter_steps = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_FIM_det", 0, 4, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2652, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM_det", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_88latent_FIM_det(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_eps, __pyx_v_measurement_error, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":2652
 *         return FIM
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,             # <<<<<<<<<<<<<<
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2713
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_14latent_FIM_det_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_14latent_FIM_det_1mean = {"mean", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_14latent_FIM_det_1mean, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_14latent_FIM_det_1mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mean (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_14latent_FIM_det_mean(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_14latent_FIM_det_mean(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mean", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":2714
 * 
 *         def mean(y):
 *             return self._latent_mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2714, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_latent_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_contactMatrix)) { __Pyx_RaiseClosureNameError("contactMatrix"); __PYX_ERR(0, 2714, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_contactMatrix, __pyx_cur_scope->__pyx_v_contactMatrix) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)

  /* "pyross/inference.pyx":2715
 *         def mean(y):
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,             # <<<<<<<<<<<<<<
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_generator)) { __Pyx_RaiseClosureNameError("generator"); __PYX_ERR(0, 2715, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_generator, __pyx_cur_scope->__pyx_v_generator) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)

  /* "pyross/inference.pyx":2716
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,             # <<<<<<<<<<<<<<
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 *                               inter_steps=inter_steps,
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_intervention_fun)) { __Pyx_RaiseClosureNameError("intervention_fun"); __PYX_ERR(0, 2716, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_intervention_fun, __pyx_cur_scope->__pyx_v_intervention_fun) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs)) { __Pyx_RaiseClosureNameError("obs"); __PYX_ERR(0, 2716, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs, __pyx_cur_scope->__pyx_v_obs) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)

  /* "pyross/inference.pyx":2717
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0,             # <<<<<<<<<<<<<<
 *                               inter_steps=inter_steps,
 *                               **kwargs)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_fltr)) { __Pyx_RaiseClosureNameError("fltr"); __PYX_ERR(0, 2717, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fltr, __pyx_cur_scope->__pyx_v_fltr) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 2717, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs0)) { __Pyx_RaiseClosureNameError("obs0"); __PYX_ERR(0, 2717, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs0, __pyx_cur_scope->__pyx_v_obs0) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)

  /* "pyross/inference.pyx":2718
 *                               intervention_fun=intervention_fun, obs=obs,
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 *                               inter_steps=inter_steps,             # <<<<<<<<<<<<<<
 *                               **kwargs)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_inter_steps)) { __Pyx_RaiseClosureNameError("inter_steps"); __PYX_ERR(0, 2718, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inter_steps, __pyx_cur_scope->__pyx_v_inter_steps) < 0) __PYX_ERR(0, 2714, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":2719
 *                               fltr=fltr, Tf=Tf, obs0=obs0,
 *                               inter_steps=inter_steps,
 *                               **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if np.all(eps == None):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 2719, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 2719, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 2719, __pyx_L1_error)

  /* "pyross/inference.pyx":2714
 * 
 *         def mean(y):
 *             return self._latent_mean(y, contactMatrix=contactMatrix,             # <<<<<<<<<<<<<<
 *                                       generator=generator,
 *                               intervention_fun=intervention_fun, obs=obs,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2713
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM_det.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2652
 *         return FIM
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,             # <<<<<<<<<<<<<<
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_88latent_FIM_det(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_eps, PyObject *__pyx_v_measurement_error, PyObject *__pyx_v_inter_steps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *__pyx_cur_scope;
  PyObject *__pyx_v_infer_result_loc = NULL;
  PyObject *__pyx_v_flat_params = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_mean = 0;
  PyObject *__pyx_v_xx = NULL;
  PyObject *__pyx_v_fx = NULL;
  PyObject *__pyx_v_fltr_ = NULL;
  PyObject *__pyx_v_sigma_sq = NULL;
  PyObject *__pyx_v_cov_diag = NULL;
  PyObject *__pyx_v_cov = NULL;
  PyObject *__pyx_v_full_fltr = NULL;
  PyObject *__pyx_v_cov_red = NULL;
  PyObject *__pyx_v_invcov = NULL;
  Py_ssize_t __pyx_v_dim;
  PyObject *__pyx_v_FIM_det = NULL;
  PyObject *__pyx_v_dmu = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_rows = NULL;
  PyObject *__pyx_v_cols = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_i_lower = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("latent_FIM_det", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det(__pyx_ptype_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2652, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_obs = __pyx_v_obs;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_obs);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_obs);
  __pyx_cur_scope->__pyx_v_fltr = __pyx_v_fltr;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fltr);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fltr);
  __pyx_cur_scope->__pyx_v_Tf = __pyx_v_Tf;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Tf);
  __pyx_cur_scope->__pyx_v_contactMatrix = __pyx_v_contactMatrix;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
  __pyx_cur_scope->__pyx_v_generator = __pyx_v_generator;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
  __pyx_cur_scope->__pyx_v_intervention_fun = __pyx_v_intervention_fun;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
  __pyx_cur_scope->__pyx_v_inter_steps = __pyx_v_inter_steps;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inter_steps);
  __Pyx_INCREF(__pyx_v_eps);

  /* "pyross/inference.pyx":2696
 *         '''
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_contactMatrix, __pyx_cur_scope->__pyx_v_generator, __pyx_cur_scope->__pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_generator);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_cur_scope->__pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2699
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         infer_result_loc = infer_result.copy()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_fltr, __pyx_cur_scope->__pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_fltr, __pyx_cur_scope->__pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_fltr);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2699, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 2699, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2699, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_fltr);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_fltr, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_obs);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_obs, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_cur_scope->__pyx_v_obs0 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2701
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)
 * 
 *         infer_result_loc = infer_result.copy()             # <<<<<<<<<<<<<<
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_infer_result_loc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2703
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_flat_map, __pyx_v_infer_result_loc, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2704
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')             # <<<<<<<<<<<<<<
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_infer_result_loc, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_n_u_flat_map) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_flat_map);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params, __pyx_t_1) < 0)) __PYX_ERR(0, 2704, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2703
 *         infer_result_loc = infer_result.copy()
 *         # backwards compatibility
 *         if 'flat_map' in infer_result_loc:             # <<<<<<<<<<<<<<
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 */
  }

  /* "pyross/inference.pyx":2706
 *             infer_result_loc['flat_params'] = infer_result_loc.pop('flat_map')
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])             # <<<<<<<<<<<<<<
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_flat_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2707
 * 
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 *         kwargs = {}             # <<<<<<<<<<<<<<
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2708
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 */
  __pyx_t_1 = __pyx_tuple__23; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
  for (;;) {
    if (__pyx_t_10 >= 7) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2708, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2711
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 *             kwargs[key] = infer_result_loc[key]             # <<<<<<<<<<<<<<
 * 
 *         def mean(y):
 */
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_v_key, __pyx_t_3) < 0)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2708
 *         flat_params = np.copy(infer_result_loc['flat_params'])
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2713
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_14latent_FIM_det_1mean, 0, __pyx_n_s_latent_FIM_det_locals_mean, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mean = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2721
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_eps, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2722
 * 
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']             # <<<<<<<<<<<<<<
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_xx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2723
 *         if np.all(eps == None):
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])             # <<<<<<<<<<<<<<
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result_loc, __pyx_n_u_log_likelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2724
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)             # <<<<<<<<<<<<<<
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_100, __pyx_v_xx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_divide); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_spacing); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_6, __pyx_v_fx) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_fx);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_3, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2724, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_3, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2724, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_fx);
      __Pyx_GIVEREF(__pyx_v_fx);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_fx);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_float_0_25, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2721
 *                               **kwargs)
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result_loc['flat_params']
 *             fx = abs(infer_result_loc['log_likelihood'])
 */
    goto __pyx_L8;
  }

  /* "pyross/inference.pyx":2726
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isscalar); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_eps) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_eps);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2726, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2727
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))             # <<<<<<<<<<<<<<
 *         print('eps-vector used for differentiation: ', eps)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_repeat); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_eps);
    __Pyx_GIVEREF(__pyx_v_eps);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_eps);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2727, __pyx_L1_error)
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_repeats, __pyx_t_6) < 0) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":2726
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**np.divide(1,3)
 *         elif np.isscalar(eps):             # <<<<<<<<<<<<<<
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)
 */
  }
  __pyx_L8:;

  /* "pyross/inference.pyx":2728
 *         elif np.isscalar(eps):
 *             eps = np.repeat(eps, repeats=len(flat_params))
 *         print('eps-vector used for differentiation: ', eps)             # <<<<<<<<<<<<<<
 * 
 *         fltr_ = fltr[1:]
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_GIVEREF(__pyx_kp_u_eps_vector_used_for_differentiat);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_eps_vector_used_for_differentiat);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_eps);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2730
 *         print('eps-vector used for differentiation: ', eps)
 * 
 *         fltr_ = fltr[1:]             # <<<<<<<<<<<<<<
 *         sigma_sq = measurement_error*measurement_error
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(fltr_.shape[0])))
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_fltr, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fltr_ = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2731
 * 
 *         fltr_ = fltr[1:]
 *         sigma_sq = measurement_error*measurement_error             # <<<<<<<<<<<<<<
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(fltr_.shape[0])))
 *         cov = np.diag(cov_diag)
 */
  __pyx_t_2 = PyNumber_Multiply(__pyx_v_measurement_error, __pyx_v_measurement_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sigma_sq = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2732
 *         fltr_ = fltr[1:]
 *         sigma_sq = measurement_error*measurement_error
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(fltr_.shape[0])))             # <<<<<<<<<<<<<<
 *         cov = np.diag(cov_diag)
 *         full_fltr = sparse.block_diag(fltr_)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_repeat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_sigma_sq);
  __Pyx_GIVEREF(__pyx_v_sigma_sq);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sigma_sq);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_fltr_, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_repeats, __pyx_t_5) < 0) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cov_diag = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2733
 *         sigma_sq = measurement_error*measurement_error
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(fltr_.shape[0])))
 *         cov = np.diag(cov_diag)             # <<<<<<<<<<<<<<
 *         full_fltr = sparse.block_diag(fltr_)
 *         cov_red = full_fltr@cov@np.transpose(full_fltr)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_diag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_cov_diag) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_cov_diag);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cov = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2734
 *         cov_diag = np.repeat(sigma_sq, repeats=(int(self.dim)*(fltr_.shape[0])))
 *         cov = np.diag(cov_diag)
 *         full_fltr = sparse.block_diag(fltr_)             # <<<<<<<<<<<<<<
 *         cov_red = full_fltr@cov@np.transpose(full_fltr)
 *         invcov = np.linalg.inv(cov_red)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sparse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_fltr_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_fltr_);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_full_fltr = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2735
 *         cov = np.diag(cov_diag)
 *         full_fltr = sparse.block_diag(fltr_)
 *         cov_red = full_fltr@cov@np.transpose(full_fltr)             # <<<<<<<<<<<<<<
 *         invcov = np.linalg.inv(cov_red)
 * 
 */
  __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, __pyx_v_cov); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_transpose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_v_full_fltr) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cov_red = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2736
 *         full_fltr = sparse.block_diag(fltr_)
 *         cov_red = full_fltr@cov@np.transpose(full_fltr)
 *         invcov = np.linalg.inv(cov_red)             # <<<<<<<<<<<<<<
 * 
 *         dim = len(flat_params)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_linalg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_inv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_cov_red) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_cov_red);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_invcov = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2738
 *         invcov = np.linalg.inv(cov_red)
 * 
 *         dim = len(flat_params)             # <<<<<<<<<<<<<<
 *         FIM_det = np.empty((dim,dim))
 *         dmu = []
 */
  __pyx_t_10 = PyObject_Length(__pyx_v_flat_params); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2738, __pyx_L1_error)
  __pyx_v_dim = __pyx_t_10;

  /* "pyross/inference.pyx":2739
 * 
 *         dim = len(flat_params)
 *         FIM_det = np.empty((dim,dim))             # <<<<<<<<<<<<<<
 *         dmu = []
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_11);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_FIM_det = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2740
 *         dim = len(flat_params)
 *         FIM_det = np.empty((dim,dim))
 *         dmu = []             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_dmu = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2742
 *         dmu = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 */
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2742, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2742, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2742, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_12(__pyx_t_6);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2742, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2743
 * 
 *         for i in range(dim):
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))             # <<<<<<<<<<<<<<
 * 
 *         for i in range(dim):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_partial_derivative); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_mean);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_var, __pyx_v_i) < 0) __PYX_ERR(0, 2743, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_point, __pyx_v_flat_params) < 0) __PYX_ERR(0, 2743, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_eps, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dx, __pyx_t_1) < 0) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dmu, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 2743, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2742
 *         dmu = []
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2745
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]
 * 
 */
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2745, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2745, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2745, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_12(__pyx_t_6);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2745, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2746
 * 
 *         for i in range(dim):
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]             # <<<<<<<<<<<<<<
 * 
 *         rows,cols = np.triu_indices(dim,1)
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_v_invcov); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_i);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM_det, __pyx_t_1, __pyx_t_11) < 0)) __PYX_ERR(0, 2746, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2745
 *             dmu.append(pyross.utils.partial_derivative(mean, var=i, point=flat_params, dx=eps[i]))
 * 
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2748
 *             FIM_det[i,i] = dmu[i]@invcov@dmu[i]
 * 
 *         rows,cols = np.triu_indices(dim,1)             # <<<<<<<<<<<<<<
 * 
 *         for i,j in zip(rows,cols):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_triu_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_11, __pyx_int_1};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_11, __pyx_int_1};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_t_11);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_1);
    __pyx_t_11 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2748, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L13_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_11), 2) < 0) __PYX_ERR(0, 2748, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L14_unpacking_done;
    __pyx_L13_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2748, __pyx_L1_error)
    __pyx_L14_unpacking_done:;
  }
  __pyx_v_rows = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_cols = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2750
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]
 * 
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_rows);
  __Pyx_GIVEREF(__pyx_v_rows);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_rows);
  __Pyx_INCREF(__pyx_v_cols);
  __Pyx_GIVEREF(__pyx_v_cols);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_cols);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2750, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2750, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2750, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 2750, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2750, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_12(__pyx_t_6);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2750, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2750, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_11);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_11 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_11)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_2), 2) < 0) __PYX_ERR(0, 2750, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2750, __pyx_L1_error)
      __pyx_L18_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2751
 * 
 *         for i,j in zip(rows,cols):
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]             # <<<<<<<<<<<<<<
 * 
 *         i_lower = np.tril_indices(dim,-1)
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_5, __pyx_v_invcov); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_dmu, __pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_11, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j);
    if (unlikely(PyObject_SetItem(__pyx_v_FIM_det, __pyx_t_5, __pyx_t_1) < 0)) __PYX_ERR(0, 2751, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2750
 *         rows,cols = np.triu_indices(dim,1)
 * 
 *         for i,j in zip(rows,cols):             # <<<<<<<<<<<<<<
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2753
 *             FIM_det[i,j] = dmu[i]@invcov@dmu[j]
 * 
 *         i_lower = np.tril_indices(dim,-1)             # <<<<<<<<<<<<<<
 *         FIM_det[i_lower] = FIM_det.T[i_lower]
 *         return FIM_det
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tril_indices); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_1, __pyx_int_neg_1};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2753, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_1, __pyx_int_neg_1};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2753, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_11) {
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_11); __pyx_t_11 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_t_1);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_int_neg_1);
    __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_i_lower = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2754
 * 
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM_det[i_lower] = FIM_det.T[i_lower]             # <<<<<<<<<<<<<<
 *         return FIM_det
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_FIM_det, __pyx_n_s_T); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_i_lower); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_FIM_det, __pyx_v_i_lower, __pyx_t_5) < 0)) __PYX_ERR(0, 2754, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2755
 *         i_lower = np.tril_indices(dim,-1)
 *         FIM_det[i_lower] = FIM_det.T[i_lower]
 *         return FIM_det             # <<<<<<<<<<<<<<
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_FIM_det);
  __pyx_r = __pyx_v_FIM_det;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2652
 *         return FIM
 * 
 *     def latent_FIM_det(self, obs, fltr, Tf, infer_result,             # <<<<<<<<<<<<<<
 *                        contactMatrix=None, generator=None,
 *                        intervention_fun=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_FIM_det", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_infer_result_loc);
  __Pyx_XDECREF(__pyx_v_flat_params);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_fx);
  __Pyx_XDECREF(__pyx_v_fltr_);
  __Pyx_XDECREF(__pyx_v_sigma_sq);
  __Pyx_XDECREF(__pyx_v_cov_diag);
  __Pyx_XDECREF(__pyx_v_cov);
  __Pyx_XDECREF(__pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_v_cov_red);
  __Pyx_XDECREF(__pyx_v_invcov);
  __Pyx_XDECREF(__pyx_v_FIM_det);
  __Pyx_XDECREF(__pyx_v_dmu);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_i_lower);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2757
 *         return FIM_det
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_91latent_hessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_90latent_hessian[] = "\n        Computes the Hessian matrix for the initial conditions and all desired parameters, including control parameters, for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        eps: float or numpy.array, optional\n            Step size for finite differences computation of the hessian with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result['flat_params'])`. I""f not specified, `100*eps_min = 100*infer_result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_posterior']),infer_result['log_posterior'])**(0.25)` is used. For `fd_method=\"central\"` it is recommended to use a step-size greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        fd_method: str, optional\n            The type of finite-difference scheme used to compute the hessian, supports \"forward\" and \"central\". Default is \"central\".\n        inter_steps: int, optional\n            Intermediate steps between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but sometimes more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 0.\n        Returns\n        -------\n        hess: 2d numpy.array\n            The Hessian matrix\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_91latent_hessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_fd_method = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_hessian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_eps,&__pyx_n_s_fd_method,&__pyx_n_s_inter_steps,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2758
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 *                        generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                        eps=None, fd_method="central", inter_steps=0):
 *         '''
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_False);

    /* "pyross/inference.pyx":2759
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=0):             # <<<<<<<<<<<<<<
 *         '''
 *         Computes the Hessian matrix for the initial conditions and all desired parameters, including control parameters, for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)__pyx_n_u_central);
    values[10] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_hessian", 0, 4, 11, 1); __PYX_ERR(0, 2757, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_hessian", 0, 4, 11, 2); __PYX_ERR(0, 2757, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_hessian", 0, 4, 11, 3); __PYX_ERR(0, 2757, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fd_method);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "latent_hessian") < 0)) __PYX_ERR(0, 2757, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_infer_result = values[3];
    __pyx_v_contactMatrix = values[4];
    __pyx_v_generator = values[5];
    __pyx_v_intervention_fun = values[6];
    __pyx_v_tangent = values[7];
    __pyx_v_eps = values[8];
    __pyx_v_fd_method = values[9];
    __pyx_v_inter_steps = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_hessian", 0, 4, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2757, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_hessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_90latent_hessian(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":2757
 *         return FIM_det
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=0):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2827
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,
 *                                            tangent=tangent, **kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_14latent_hessian_1minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_14latent_hessian_1minuslogp = {"minuslogp", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_14latent_hessian_1minuslogp, METH_O, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_14latent_hessian_1minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minuslogp (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_14latent_hessian_minuslogp(__pyx_self, ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_14latent_hessian_minuslogp(PyObject *__pyx_self, PyObject *__pyx_v_y) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("minuslogp", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":2828
 * 
 *         def minuslogp(y):
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,             # <<<<<<<<<<<<<<
 *                                            tangent=tangent, **kwargs)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2828, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_latent_infer_to_minimize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs)) { __Pyx_RaiseClosureNameError("obs"); __PYX_ERR(0, 2828, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs, __pyx_cur_scope->__pyx_v_obs) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_fltr)) { __Pyx_RaiseClosureNameError("fltr"); __PYX_ERR(0, 2828, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fltr, __pyx_cur_scope->__pyx_v_fltr) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_Tf)) { __Pyx_RaiseClosureNameError("Tf"); __PYX_ERR(0, 2828, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Tf, __pyx_cur_scope->__pyx_v_Tf) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_obs0)) { __Pyx_RaiseClosureNameError("obs0"); __PYX_ERR(0, 2828, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_obs0, __pyx_cur_scope->__pyx_v_obs0) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)

  /* "pyross/inference.pyx":2829
 *         def minuslogp(y):
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,
 *                                            tangent=tangent, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_tangent)) { __Pyx_RaiseClosureNameError("tangent"); __PYX_ERR(0, 2829, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tangent, __pyx_cur_scope->__pyx_v_tangent) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_kwargs)) { __Pyx_RaiseClosureNameError("kwargs"); __PYX_ERR(0, 2829, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 2829, __pyx_L1_error)
  }
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 2829, __pyx_L1_error)

  /* "pyross/inference.pyx":2828
 * 
 *         def minuslogp(y):
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,             # <<<<<<<<<<<<<<
 *                                            tangent=tangent, **kwargs)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2827
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,
 *                                            tangent=tangent, **kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_hessian.minuslogp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2757
 *         return FIM_det
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=0):
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_90latent_hessian(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *__pyx_cur_scope;
  PyObject *__pyx_v_flat_params = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_xx = NULL;
  PyObject *__pyx_v_fx = NULL;
  PyObject *__pyx_v_minuslogp = 0;
  PyObject *__pyx_v_hess = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("latent_hessian", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_6_latent_hessian(__pyx_ptype_6pyross_9inference___pyx_scope_struct_6_latent_hessian, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2757, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_obs = __pyx_v_obs;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_obs);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_obs);
  __pyx_cur_scope->__pyx_v_fltr = __pyx_v_fltr;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fltr);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fltr);
  __pyx_cur_scope->__pyx_v_Tf = __pyx_v_Tf;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Tf);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Tf);
  __pyx_cur_scope->__pyx_v_tangent = __pyx_v_tangent;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tangent);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tangent);
  __Pyx_INCREF(__pyx_v_eps);

  /* "pyross/inference.pyx":2802
 *         '''
 *         # Sanity checks of the intputs
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 * 
 *         # Process fltr and obs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2802, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2802, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2805
 * 
 *         # Process fltr and obs
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         flat_params = np.copy(infer_result['flat_params'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_fltr, __pyx_cur_scope->__pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_fltr, __pyx_cur_scope->__pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_fltr);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2805, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 2805, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2805, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_fltr);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_fltr, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_obs);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_obs, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_cur_scope->__pyx_v_obs0 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":2807
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)
 * 
 *         flat_params = np.copy(infer_result['flat_params'])             # <<<<<<<<<<<<<<
 * 
 *         kwargs = {}
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_flat_params = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2809
 *         flat_params = np.copy(infer_result['flat_params'])
 * 
 *         kwargs = {}             # <<<<<<<<<<<<<<
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2810
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs', 'prior']:
 */
  __pyx_t_1 = __pyx_tuple__30; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= 8) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 2810, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2813
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs', 'prior']:
 *             kwargs[key] = infer_result[key]             # <<<<<<<<<<<<<<
 * 
 *         kwargs['generator']=generator
 */
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_v_key, __pyx_t_3) < 0)) __PYX_ERR(0, 2813, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":2810
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs', 'prior']:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2815
 *             kwargs[key] = infer_result[key]
 * 
 *         kwargs['generator']=generator             # <<<<<<<<<<<<<<
 *         kwargs['intervention_fun']=intervention_fun
 *         kwargs['inter_steps']=inter_steps
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_generator, __pyx_v_generator) < 0)) __PYX_ERR(0, 2815, __pyx_L1_error)

  /* "pyross/inference.pyx":2816
 * 
 *         kwargs['generator']=generator
 *         kwargs['intervention_fun']=intervention_fun             # <<<<<<<<<<<<<<
 *         kwargs['inter_steps']=inter_steps
 *         kwargs['disable_penalty']=None
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_intervention_fun, __pyx_v_intervention_fun) < 0)) __PYX_ERR(0, 2816, __pyx_L1_error)

  /* "pyross/inference.pyx":2817
 *         kwargs['generator']=generator
 *         kwargs['intervention_fun']=intervention_fun
 *         kwargs['inter_steps']=inter_steps             # <<<<<<<<<<<<<<
 *         kwargs['disable_penalty']=None
 * 
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_inter_steps, __pyx_v_inter_steps) < 0)) __PYX_ERR(0, 2817, __pyx_L1_error)

  /* "pyross/inference.pyx":2818
 *         kwargs['intervention_fun']=intervention_fun
 *         kwargs['inter_steps']=inter_steps
 *         kwargs['disable_penalty']=None             # <<<<<<<<<<<<<<
 * 
 *         if np.all(eps == None):
 */
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_u_disable_penalty, Py_None) < 0)) __PYX_ERR(0, 2818, __pyx_L1_error)

  /* "pyross/inference.pyx":2820
 *         kwargs['disable_penalty']=None
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_eps, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":2821
 * 
 *         if np.all(eps == None):
 *             xx = infer_result['flat_params']             # <<<<<<<<<<<<<<
 *             fx = abs(infer_result['log_posterior'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_flat_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_xx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2822
 *         if np.all(eps == None):
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])             # <<<<<<<<<<<<<<
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**(0.25)
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_log_posterior); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_fx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":2823
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)             # <<<<<<<<<<<<<<
 *             #eps = 10.*np.spacing(flat_params)**(0.25)
 *         print('epsilon used for differentiation: ', eps)
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_100, __pyx_v_xx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_divide); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_spacing); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_6, __pyx_v_fx) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_fx);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2823, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_v_fx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2823, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_fx);
      __Pyx_GIVEREF(__pyx_v_fx);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_fx);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_float_0_25, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":2820
 *         kwargs['disable_penalty']=None
 * 
 *         if np.all(eps == None):             # <<<<<<<<<<<<<<
 *             xx = infer_result['flat_params']
 *             fx = abs(infer_result['log_posterior'])
 */
  }

  /* "pyross/inference.pyx":2825
 *             eps = 100 * xx * np.divide(np.spacing(fx),fx)**(0.25)
 *             #eps = 10.*np.spacing(flat_params)**(0.25)
 *         print('epsilon used for differentiation: ', eps)             # <<<<<<<<<<<<<<
 * 
 *         def minuslogp(y):
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_u_epsilon_used_for_differentiation);
  __Pyx_GIVEREF(__pyx_kp_u_epsilon_used_for_differentiation);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_epsilon_used_for_differentiation);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_eps);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2827
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,
 *                                            tangent=tangent, **kwargs)
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_14latent_hessian_1minuslogp, 0, __pyx_n_s_latent_hessian_locals_minuslogp, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_minuslogp = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2831
 *                                            tangent=tangent, **kwargs)
 * 
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)             # <<<<<<<<<<<<<<
 *         return hess
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_hessian_finite_difference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_flat_params);
  __Pyx_GIVEREF(__pyx_v_flat_params);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flat_params);
  __Pyx_INCREF(__pyx_v_minuslogp);
  __Pyx_GIVEREF(__pyx_v_minuslogp);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_minuslogp);
  __Pyx_INCREF(__pyx_v_eps);
  __Pyx_GIVEREF(__pyx_v_eps);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_eps);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_method, __pyx_v_fd_method) < 0) __PYX_ERR(0, 2831, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_hess = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":2832
 * 
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 *         return hess             # <<<<<<<<<<<<<<
 * 
 *     def sample_gaussian_latent(self, N, map_estimate, cov, obs, fltr, Tf, contactMatrix, param_priors, init_priors,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_hess);
  __pyx_r = __pyx_v_hess;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2757
 *         return FIM_det
 * 
 *     def latent_hessian(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_hessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_flat_params);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_fx);
  __Pyx_XDECREF(__pyx_v_minuslogp);
  __Pyx_XDECREF(__pyx_v_hess);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2834
 *         return hess
 * 
 *     def sample_gaussian_latent(self, N, map_estimate, cov, obs, fltr, Tf, contactMatrix, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                tangent=False):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_93sample_gaussian_latent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_92sample_gaussian_latent[] = "\n        Sample `N` samples of the parameters from the Gaussian centered at the MAP estimate with specified\n        covariance `cov`.\n\n        Parameters\n        ----------\n        N: int\n            The number of samples.\n        map_estimate: dict\n            The MAP estimate, e.g. as computed by `inference.latent_infer`.\n        cov: np.array\n            The covariance matrix of the flat parameters.\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            The total time of the trajectory.\n        contactMatrix: callable\n            A function that returns the contact matrix at time t (input).\n        param_priors: dict\n            A dictionary that specifies priors for parameters.\n            See `infer` for examples.\n        init_priors: dict\n            A dictionary that specifies priors for initial conditions.\n            See below for examples.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n\n        Returns\n        -------\n        samples: list of dict\n            N samples of the Gaussian distribution.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_93sample_gaussian_latent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_map_estimate = 0;
  PyObject *__pyx_v_cov = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_param_priors = 0;
  PyObject *__pyx_v_init_priors = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sample_gaussian_latent (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_map_estimate,&__pyx_n_s_cov_2,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_param_priors,&__pyx_n_s_init_priors,&__pyx_n_s_tangent,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":2835
 * 
 *     def sample_gaussian_latent(self, N, map_estimate, cov, obs, fltr, Tf, contactMatrix, param_priors, init_priors,
 *                                tangent=False):             # <<<<<<<<<<<<<<
 *         """
 *         Sample `N` samples of the parameters from the Gaussian centered at the MAP estimate with specified
 */
    values[9] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_map_estimate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 1); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cov_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 2); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 3); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 4); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 5); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 6); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 7); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, 8); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sample_gaussian_latent") < 0)) __PYX_ERR(0, 2834, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
    __pyx_v_map_estimate = values[1];
    __pyx_v_cov = values[2];
    __pyx_v_obs = values[3];
    __pyx_v_fltr = values[4];
    __pyx_v_Tf = values[5];
    __pyx_v_contactMatrix = values[6];
    __pyx_v_param_priors = values[7];
    __pyx_v_init_priors = values[8];
    __pyx_v_tangent = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sample_gaussian_latent", 0, 9, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2834, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_gaussian_latent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_92sample_gaussian_latent(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_N, __pyx_v_map_estimate, __pyx_v_cov, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_param_priors, __pyx_v_init_priors, __pyx_v_tangent);

  /* "pyross/inference.pyx":2834
 *         return hess
 * 
 *     def sample_gaussian_latent(self, N, map_estimate, cov, obs, fltr, Tf, contactMatrix, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                tangent=False):
 *         """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_92sample_gaussian_latent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_map_estimate, PyObject *__pyx_v_cov, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_param_priors, PyObject *__pyx_v_init_priors, PyObject *__pyx_v_tangent) {
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_param_prior_names = NULL;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_param_guess = NULL;
  PyObject *__pyx_v_param_stds = NULL;
  PyObject *__pyx_v_param_bounds = NULL;
  PyObject *__pyx_v_param_guess_range = NULL;
  PyObject *__pyx_v_is_scale_parameter = NULL;
  PyObject *__pyx_v_scaled_param_guesses = NULL;
  PyObject *__pyx_v_init_prior_names = NULL;
  PyObject *__pyx_v_init_guess = NULL;
  PyObject *__pyx_v_init_stds = NULL;
  PyObject *__pyx_v_init_bounds = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_param_length = NULL;
  PyObject *__pyx_v_guess = NULL;
  PyObject *__pyx_v_stds = NULL;
  PyObject *__pyx_v_bounds = NULL;
  PyObject *__pyx_v_prior = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_cma_stds = NULL;
  PyObject *__pyx_v_loglike_args = NULL;
  PyObject *__pyx_v_mean = NULL;
  PyObject *__pyx_v_sample_parameters = NULL;
  PyObject *__pyx_v_samples = NULL;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_v_new_sample = NULL;
  PyObject *__pyx_v_param_estimates = NULL;
  PyObject *__pyx_v_init_estimates = NULL;
  PyObject *__pyx_v_l_like = NULL;
  PyObject *__pyx_v_l_prior = NULL;
  PyObject *__pyx_v_l_post = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("sample_gaussian_latent", 0);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);

  /* "pyross/inference.pyx":2871
 *             N samples of the Gaussian distribution.
 *         """
 *         self.contactMatrix = contactMatrix             # <<<<<<<<<<<<<<
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)
 * 
 */
  __Pyx_INCREF(__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_v_contactMatrix);
  __Pyx_GOTREF(__pyx_v_self->contactMatrix);
  __Pyx_DECREF(__pyx_v_self->contactMatrix);
  __pyx_v_self->contactMatrix = __pyx_v_contactMatrix;

  /* "pyross/inference.pyx":2872
 *         """
 *         self.contactMatrix = contactMatrix
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # Read in parameter priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fltr);
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2872, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 2872, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2872, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_fltr, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_obs0 = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":2877
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))             # <<<<<<<<<<<<<<
 * 
 *         # Read in initial conditions priors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyross); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_parse_param_prior_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_v_param_priors);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_param_priors);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(__pyx_v_self->param_mapping_enabled != 0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_check_length, __pyx_t_2) < 0) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 8)) {
      if (size > 8) __Pyx_RaiseTooManyValuesError(8);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2875, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[8] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
      for (i=0; i < 8; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2875, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[8] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_1,&__pyx_t_6,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
    __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_12)->tp_iternext;
    for (index=0; index < 8; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_12); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_12), 8) < 0) __PYX_ERR(0, 2875, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2875, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }

  /* "pyross/inference.pyx":2875
 * 
 *         # Read in parameter priors
 *         param_prior_names, keys, param_guess, param_stds, param_bounds, param_guess_range, \             # <<<<<<<<<<<<<<
 *         is_scale_parameter, scaled_param_guesses \
 *             = pyross.utils.parse_param_prior_dict(param_priors, self.M, check_length=(not self.param_mapping_enabled))
 */
  __pyx_v_param_prior_names = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_keys = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_param_guess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_param_stds = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_param_bounds = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_param_guess_range = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_is_scale_parameter = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_scaled_param_guesses = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "pyross/inference.pyx":2881
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 * 
 *         # Concatenate the flattend parameter guess with init guess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pyross); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_utils); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_13 = PyObject_Length(__pyx_v_obs0); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2881, __pyx_L1_error)
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2881, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_init_priors, __pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2881, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_t_9);
    __pyx_t_10 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2880, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2880, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_6,&__pyx_t_9,&__pyx_t_10,&__pyx_t_8,&__pyx_t_1};
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_5); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 6) < 0) __PYX_ERR(0, 2880, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2880, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }

  /* "pyross/inference.pyx":2880
 * 
 *         # Read in initial conditions priors
 *         init_prior_names, init_guess, init_stds, init_bounds, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 * 
 */
  __pyx_v_init_prior_names = __pyx_t_11;
  __pyx_t_11 = 0;
  __pyx_v_init_guess = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_init_stds = __pyx_t_9;
  __pyx_t_9 = 0;
  __pyx_v_init_bounds = __pyx_t_10;
  __pyx_t_10 = 0;
  __pyx_v_init_flags = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_init_fltrs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2884
 * 
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]             # <<<<<<<<<<<<<<
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_param_guess, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_param_length = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2885
 *         # Concatenate the flattend parameter guess with init guess
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_guess);
  __Pyx_GIVEREF(__pyx_v_param_guess);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_guess);
  __Pyx_INCREF(__pyx_v_init_guess);
  __Pyx_GIVEREF(__pyx_v_init_guess);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_guess);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_guess = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2886
 *         param_length = param_guess.shape[0]
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)             # <<<<<<<<<<<<<<
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_param_stds);
  __Pyx_GIVEREF(__pyx_v_param_stds);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_param_stds);
  __Pyx_INCREF(__pyx_v_init_stds);
  __Pyx_GIVEREF(__pyx_v_init_stds);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_init_stds);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2887
 *         guess = np.concatenate([param_guess, init_guess]).astype(DTYPE)
 *         stds = np.concatenate([param_stds,init_stds]).astype(DTYPE)
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)             # <<<<<<<<<<<<<<
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_param_bounds);
  __Pyx_GIVEREF(__pyx_v_param_bounds);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_param_bounds);
  __Pyx_INCREF(__pyx_v_init_bounds);
  __Pyx_GIVEREF(__pyx_v_init_bounds);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_init_bounds);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 2887, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2889
 *         bounds = np.concatenate([param_bounds, init_bounds], axis=0).astype(DTYPE)
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)             # <<<<<<<<<<<<<<
 *         cma_stds = np.minimum(stds, (bounds[:, 1]-bounds[:, 0])/3)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Add(__pyx_v_param_prior_names, __pyx_v_init_prior_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2889, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_t_9, __pyx_v_bounds, __pyx_v_guess, __pyx_v_stds};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2889, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_bounds);
    __Pyx_INCREF(__pyx_v_guess);
    __Pyx_GIVEREF(__pyx_v_guess);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_v_guess);
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_4, __pyx_v_stds);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_prior = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2890
 * 
 *         prior = Prior(param_prior_names+init_prior_names, bounds, guess, stds)
 *         cma_stds = np.minimum(stds, (bounds[:, 1]-bounds[:, 0])/3)             # <<<<<<<<<<<<<<
 * 
 *         loglike_args = {'param_keys':keys, 'param_guess_range':param_guess_range,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_minimum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_bounds, __pyx_tuple__2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_2, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_stds, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_stds, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_stds);
    __Pyx_GIVEREF(__pyx_v_stds);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_v_stds);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_cma_stds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2892
 *         cma_stds = np.minimum(stds, (bounds[:, 1]-bounds[:, 0])/3)
 * 
 *         loglike_args = {'param_keys':keys, 'param_guess_range':param_guess_range,             # <<<<<<<<<<<<<<
 *                         'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_keys, __pyx_v_keys) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_guess_range, __pyx_v_param_guess_range) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)

  /* "pyross/inference.pyx":2893
 * 
 *         loglike_args = {'param_keys':keys, 'param_guess_range':param_guess_range,
 *                         'is_scale_parameter':is_scale_parameter,             # <<<<<<<<<<<<<<
 *                         'scaled_param_guesses':scaled_param_guesses,
 *                         'param_length':param_length,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_is_scale_parameter, __pyx_v_is_scale_parameter) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)

  /* "pyross/inference.pyx":2894
 *         loglike_args = {'param_keys':keys, 'param_guess_range':param_guess_range,
 *                         'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses,             # <<<<<<<<<<<<<<
 *                         'param_length':param_length,
 *                         'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_scaled_param_guesses, __pyx_v_scaled_param_guesses) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)

  /* "pyross/inference.pyx":2895
 *                         'is_scale_parameter':is_scale_parameter,
 *                         'scaled_param_guesses':scaled_param_guesses,
 *                         'param_length':param_length,             # <<<<<<<<<<<<<<
 *                         'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 *                         'init_flags':init_flags, 'init_fltrs': init_fltrs,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_param_length, __pyx_v_param_length) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)

  /* "pyross/inference.pyx":2896
 *                         'scaled_param_guesses':scaled_param_guesses,
 *                         'param_length':param_length,
 *                         'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,             # <<<<<<<<<<<<<<
 *                         'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                         'tangent':tangent}
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs, __pyx_v_obs) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fltr, __pyx_v_fltr) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Tf, __pyx_v_Tf) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_obs0, __pyx_v_obs0) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)

  /* "pyross/inference.pyx":2897
 *                         'param_length':param_length,
 *                         'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 *                         'init_flags':init_flags, 'init_fltrs': init_fltrs,             # <<<<<<<<<<<<<<
 *                         'tangent':tangent}
 * 
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_flags, __pyx_v_init_flags) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_init_fltrs, __pyx_v_init_fltrs) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)

  /* "pyross/inference.pyx":2898
 *                         'obs':obs, 'fltr':fltr, 'Tf':Tf, 'obs0':obs0,
 *                         'init_flags':init_flags, 'init_fltrs': init_fltrs,
 *                         'tangent':tangent}             # <<<<<<<<<<<<<<
 * 
 *         # Sample the flat parameters.
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tangent, __pyx_v_tangent) < 0) __PYX_ERR(0, 2892, __pyx_L1_error)
  __pyx_v_loglike_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2901
 * 
 *         # Sample the flat parameters.
 *         mean = map_estimate['flat_map']             # <<<<<<<<<<<<<<
 *         sample_parameters = np.random.multivariate_normal(mean, cov, N)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_flat_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mean = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2902
 *         # Sample the flat parameters.
 *         mean = map_estimate['flat_map']
 *         sample_parameters = np.random.multivariate_normal(mean, cov, N)             # <<<<<<<<<<<<<<
 * 
 *         samples = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_random); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_mean, __pyx_v_cov, __pyx_v_N};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2902, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_mean, __pyx_v_cov, __pyx_v_N};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2902, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_4, __pyx_v_mean);
    __Pyx_INCREF(__pyx_v_cov);
    __Pyx_GIVEREF(__pyx_v_cov);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_4, __pyx_v_cov);
    __Pyx_INCREF(__pyx_v_N);
    __Pyx_GIVEREF(__pyx_v_N);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_4, __pyx_v_N);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_sample_parameters = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2904
 *         sample_parameters = np.random.multivariate_normal(mean, cov, N)
 * 
 *         samples = []             # <<<<<<<<<<<<<<
 *         for sample in sample_parameters:
 *             new_sample = map_estimate.copy()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_samples = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2905
 * 
 *         samples = []
 *         for sample in sample_parameters:             # <<<<<<<<<<<<<<
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample
 */
  if (likely(PyList_CheckExact(__pyx_v_sample_parameters)) || PyTuple_CheckExact(__pyx_v_sample_parameters)) {
    __pyx_t_1 = __pyx_v_sample_parameters; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sample_parameters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2905, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2905, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2905, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2905, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2905, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      }
    } else {
      __pyx_t_10 = __pyx_t_14(__pyx_t_1);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2905, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_10);
    }
    __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2906
 *         samples = []
 *         for sample in sample_parameters:
 *             new_sample = map_estimate.copy()             # <<<<<<<<<<<<<<
 *             new_sample['flat_params'] = sample
 *             param_estimates = sample[:map_estimate['param_length']]
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_map_estimate, __pyx_n_s_copy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_10 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_sample, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2907
 *         for sample in sample_parameters:
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample             # <<<<<<<<<<<<<<
 *             param_estimates = sample[:map_estimate['param_length']]
 *             init_estimates = sample[map_estimate['param_length']:]
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_flat_params, __pyx_v_sample) < 0)) __PYX_ERR(0, 2907, __pyx_L1_error)

    /* "pyross/inference.pyx":2908
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample
 *             param_estimates = sample[:map_estimate['param_length']]             # <<<<<<<<<<<<<<
 *             init_estimates = sample[map_estimate['param_length']:]
 *             new_sample['map_params_dict'] = \
 */
    __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_param_length); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_sample, 0, 0, NULL, &__pyx_t_10, NULL, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_param_estimates, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":2909
 *             new_sample['flat_params'] = sample
 *             param_estimates = sample[:map_estimate['param_length']]
 *             init_estimates = sample[map_estimate['param_length']:]             # <<<<<<<<<<<<<<
 *             new_sample['map_params_dict'] = \
 *                 pyross.utils.unflatten_parameters(param_estimates, map_estimate['param_guess_range'],
 */
    __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_param_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_sample, 0, 0, &__pyx_t_9, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_init_estimates, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2911
 *             init_estimates = sample[map_estimate['param_length']:]
 *             new_sample['map_params_dict'] = \
 *                 pyross.utils.unflatten_parameters(param_estimates, map_estimate['param_guess_range'],             # <<<<<<<<<<<<<<
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_param_guesses'])
 *             new_sample['map_x0'] = self._construct_inits(init_estimates, map_estimate['init_flags'],
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyross); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_utils); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_unflatten_parameters); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_param_guess_range); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "pyross/inference.pyx":2912
 *             new_sample['map_params_dict'] = \
 *                 pyross.utils.unflatten_parameters(param_estimates, map_estimate['param_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_param_guesses'])             # <<<<<<<<<<<<<<
 *             new_sample['map_x0'] = self._construct_inits(init_estimates, map_estimate['init_flags'],
 *                                       map_estimate['init_fltrs'], obs0, fltr[0])
 */
    __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_is_scale_parameter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_scaled_param_guesses); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_param_estimates, __pyx_t_8, __pyx_t_2, __pyx_t_6};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2911, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_param_estimates, __pyx_t_8, __pyx_t_2, __pyx_t_6};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2911, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2911, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_param_estimates);
      __Pyx_GIVEREF(__pyx_v_param_estimates);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_param_estimates);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2911, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyross/inference.pyx":2910
 *             param_estimates = sample[:map_estimate['param_length']]
 *             init_estimates = sample[map_estimate['param_length']:]
 *             new_sample['map_params_dict'] = \             # <<<<<<<<<<<<<<
 *                 pyross.utils.unflatten_parameters(param_estimates, map_estimate['param_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_param_guesses'])
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_map_params_dict, __pyx_t_10) < 0)) __PYX_ERR(0, 2910, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2913
 *                 pyross.utils.unflatten_parameters(param_estimates, map_estimate['param_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_param_guesses'])
 *             new_sample['map_x0'] = self._construct_inits(init_estimates, map_estimate['init_flags'],             # <<<<<<<<<<<<<<
 *                                       map_estimate['init_fltrs'], obs0, fltr[0])
 *             l_like = self._loglike_latent(sample, **loglike_args)
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_init_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "pyross/inference.pyx":2914
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_param_guesses'])
 *             new_sample['map_x0'] = self._construct_inits(init_estimates, map_estimate['init_flags'],
 *                                       map_estimate['init_fltrs'], obs0, fltr[0])             # <<<<<<<<<<<<<<
 *             l_like = self._loglike_latent(sample, **loglike_args)
 *             l_prior = np.sum(prior.logpdf(sample))
 */
    __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_map_estimate, __pyx_n_u_init_fltrs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fltr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_init_estimates, __pyx_t_5, __pyx_t_6, __pyx_v_obs0, __pyx_t_2};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2913, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_init_estimates, __pyx_t_5, __pyx_t_6, __pyx_v_obs0, __pyx_t_2};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2913, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_init_estimates);
      __Pyx_GIVEREF(__pyx_v_init_estimates);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_4, __pyx_v_init_estimates);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_4, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_4, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_obs0);
      __Pyx_GIVEREF(__pyx_v_obs0);
      PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_4, __pyx_v_obs0);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_4, __pyx_t_2);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyross/inference.pyx":2913
 *                 pyross.utils.unflatten_parameters(param_estimates, map_estimate['param_guess_range'],
 *                         map_estimate['is_scale_parameter'], map_estimate['scaled_param_guesses'])
 *             new_sample['map_x0'] = self._construct_inits(init_estimates, map_estimate['init_flags'],             # <<<<<<<<<<<<<<
 *                                       map_estimate['init_fltrs'], obs0, fltr[0])
 *             l_like = self._loglike_latent(sample, **loglike_args)
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_map_x0, __pyx_t_10) < 0)) __PYX_ERR(0, 2913, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pyross/inference.pyx":2915
 *             new_sample['map_x0'] = self._construct_inits(init_estimates, map_estimate['init_flags'],
 *                                       map_estimate['init_fltrs'], obs0, fltr[0])
 *             l_like = self._loglike_latent(sample, **loglike_args)             # <<<<<<<<<<<<<<
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loglike_latent); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_sample);
    __Pyx_GIVEREF(__pyx_v_sample);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_sample);
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, __pyx_v_loglike_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_like, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2916
 *                                       map_estimate['init_fltrs'], obs0, fltr[0])
 *             l_like = self._loglike_latent(sample, **loglike_args)
 *             l_prior = np.sum(prior.logpdf(sample))             # <<<<<<<<<<<<<<
 *             l_post = l_like + l_prior
 *             new_sample['log_posterior'] = l_post
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_n_s_logpdf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_sample) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sample);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_l_prior, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2917
 *             l_like = self._loglike_latent(sample, **loglike_args)
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior             # <<<<<<<<<<<<<<
 *             new_sample['log_posterior'] = l_post
 *             new_sample['log_prior'] = l_prior
 */
    __pyx_t_11 = PyNumber_Add(__pyx_v_l_like, __pyx_v_l_prior); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_XDECREF_SET(__pyx_v_l_post, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "pyross/inference.pyx":2918
 *             l_prior = np.sum(prior.logpdf(sample))
 *             l_post = l_like + l_prior
 *             new_sample['log_posterior'] = l_post             # <<<<<<<<<<<<<<
 *             new_sample['log_prior'] = l_prior
 *             new_sample['log_likelihood'] = l_like
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_log_posterior, __pyx_v_l_post) < 0)) __PYX_ERR(0, 2918, __pyx_L1_error)

    /* "pyross/inference.pyx":2919
 *             l_post = l_like + l_prior
 *             new_sample['log_posterior'] = l_post
 *             new_sample['log_prior'] = l_prior             # <<<<<<<<<<<<<<
 *             new_sample['log_likelihood'] = l_like
 *             samples.append(new_sample)
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_log_prior, __pyx_v_l_prior) < 0)) __PYX_ERR(0, 2919, __pyx_L1_error)

    /* "pyross/inference.pyx":2920
 *             new_sample['log_posterior'] = l_post
 *             new_sample['log_prior'] = l_prior
 *             new_sample['log_likelihood'] = l_like             # <<<<<<<<<<<<<<
 *             samples.append(new_sample)
 * 
 */
    if (unlikely(PyObject_SetItem(__pyx_v_new_sample, __pyx_n_u_log_likelihood, __pyx_v_l_like) < 0)) __PYX_ERR(0, 2920, __pyx_L1_error)

    /* "pyross/inference.pyx":2921
 *             new_sample['log_prior'] = l_prior
 *             new_sample['log_likelihood'] = l_like
 *             samples.append(new_sample)             # <<<<<<<<<<<<<<
 * 
 *         return samples
 */
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_samples, __pyx_v_new_sample); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 2921, __pyx_L1_error)

    /* "pyross/inference.pyx":2905
 * 
 *         samples = []
 *         for sample in sample_parameters:             # <<<<<<<<<<<<<<
 *             new_sample = map_estimate.copy()
 *             new_sample['flat_params'] = sample
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2923
 *             samples.append(new_sample)
 * 
 *         return samples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_samples);
  __pyx_r = __pyx_v_samples;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2834
 *         return hess
 * 
 *     def sample_gaussian_latent(self, N, map_estimate, cov, obs, fltr, Tf, contactMatrix, param_priors, init_priors,             # <<<<<<<<<<<<<<
 *                                tangent=False):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_gaussian_latent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_param_prior_names);
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_param_guess);
  __Pyx_XDECREF(__pyx_v_param_stds);
  __Pyx_XDECREF(__pyx_v_param_bounds);
  __Pyx_XDECREF(__pyx_v_param_guess_range);
  __Pyx_XDECREF(__pyx_v_is_scale_parameter);
  __Pyx_XDECREF(__pyx_v_scaled_param_guesses);
  __Pyx_XDECREF(__pyx_v_init_prior_names);
  __Pyx_XDECREF(__pyx_v_init_guess);
  __Pyx_XDECREF(__pyx_v_init_stds);
  __Pyx_XDECREF(__pyx_v_init_bounds);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_param_length);
  __Pyx_XDECREF(__pyx_v_guess);
  __Pyx_XDECREF(__pyx_v_stds);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_cma_stds);
  __Pyx_XDECREF(__pyx_v_loglike_args);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_sample_parameters);
  __Pyx_XDECREF(__pyx_v_samples);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XDECREF(__pyx_v_new_sample);
  __Pyx_XDECREF(__pyx_v_param_estimates);
  __Pyx_XDECREF(__pyx_v_init_estimates);
  __Pyx_XDECREF(__pyx_v_l_like);
  __Pyx_XDECREF(__pyx_v_l_prior);
  __Pyx_XDECREF(__pyx_v_l_post);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_XDECREF(__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2926
 * 
 * 
 *     def latent_evidence_laplace(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=100):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_95latent_evidence_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_94latent_evidence_laplace[] = "\n        Compute the evidence using a Laplace approximation at the MAP estimate for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.\n\n        Parameters\n        ----------\n        obs:  np.array\n            The partially observed trajectory.\n        fltr: 2d np.array\n            The filter for the observation such that\n            :math:`F_{ij} x_j (t) = obs_i(t)`\n        Tf: float\n            Total time of the trajectory\n        infer_result: dict\n            Dictionary returned by latent_infer\n        contactMatrix: callable, optional\n            A function that returns the contact matrix at time t (input). If specified, control parameters are not inferred.\n            Either a contactMatrix or a generator must be specified.\n        generator: pyross.contactMatrix, optional\n            A pyross.contactMatrix object that generates a contact matrix function with specified lockdown\n            parameters.\n            Either a contactMatrix or a generator must be specified.\n        intervention_fun: callable, optional\n            The calling signature is `intervention_func(t, **kwargs)`,\n            where t is time and kwargs are other keyword arguments for the function.\n            The function must return (aW, aS, aO), where aW, aS and aO are (2, M) arrays.\n            The contact matrices are then rescaled as :math:`aW[0]_i CW_{ij} aW[1]_j` etc.\n            If not set, assume intervention that's constant in time.\n            See `contactMatrix.constant_contactMatrix` for details on the keyword parameters.\n        tangent: bool, optional\n            Set to True to use tangent space inference. Default is False.\n        eps: float or numpy.array, optional\n            Step size for finite differences computation of the hessian with respect to the parameters. Must be either a scalar, or an array of length `len(infer_result['flat_params'])`. If not specified, `100*eps_min = 100*infer_""result['flat_params']*numpy.divide(numpy.spacing(infer_result['log_posterior']),infer_result['log_posterior'])**(0.25)` is used. For `fd_method=\"central\"` it is recommended to use a step-size greater or equal to `eps_min`. Decreasing the step size too small can result in round-off error.\n        fd_method: str, optional\n            The type of finite-difference scheme used to compute the hessian, supports \"forward\" and \"central\". Default is \"central\".\n        inter_steps: int, optional\n            Intermediate steps between observations for the deterministic forward Euler integration. A higher number of intermediate steps will improve the accuracy of the result, but will make computations slower. Setting `inter_steps=0` will fall back to the method accessible via `det_method` for the deterministic integration. We have found that forward Euler is generally slower, but more stable for derivatives with respect to parameters than the variable step size integrators used elsewhere in pyross. Default is 100.\n        Returns\n        -------\n        log_evidence: float\n            The log-evidence computed via Laplace approximation at the MAP estimate.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_95latent_evidence_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_fd_method = 0;
  PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latent_evidence_laplace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_eps,&__pyx_n_s_fd_method,&__pyx_n_s_inter_steps,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":2927
 * 
 *     def latent_evidence_laplace(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 *                        generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                        eps=None, fd_method="central", inter_steps=100):
 *         '''
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_False);

    /* "pyross/inference.pyx":2928
 *     def latent_evidence_laplace(self, obs, fltr, Tf, infer_result, contactMatrix=None,
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=100):             # <<<<<<<<<<<<<<
 *         '''
 *         Compute the evidence using a Laplace approximation at the MAP estimate for a SIR type model with partially observed classes. The unobserved classes are treated as latent variables.
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)__pyx_n_u_central);
    values[10] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_evidence_laplace", 0, 4, 11, 1); __PYX_ERR(0, 2926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_evidence_laplace", 0, 4, 11, 2); __PYX_ERR(0, 2926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("latent_evidence_laplace", 0, 4, 11, 3); __PYX_ERR(0, 2926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fd_method);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "latent_evidence_laplace") < 0)) __PYX_ERR(0, 2926, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_infer_result = values[3];
    __pyx_v_contactMatrix = values[4];
    __pyx_v_generator = values[5];
    __pyx_v_intervention_fun = values[6];
    __pyx_v_tangent = values[7];
    __pyx_v_eps = values[8];
    __pyx_v_fd_method = values[9];
    __pyx_v_inter_steps = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("latent_evidence_laplace", 0, 4, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_evidence_laplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_94latent_evidence_laplace(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":2926
 * 
 * 
 *     def latent_evidence_laplace(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=100):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_94latent_evidence_laplace(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, PyObject *__pyx_v_tangent, PyObject *__pyx_v_eps, PyObject *__pyx_v_fd_method, PyObject *__pyx_v_inter_steps) {
  PyObject *__pyx_v_logP_MAPs = NULL;
  PyObject *__pyx_v_A = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("latent_evidence_laplace", 0);

  /* "pyross/inference.pyx":2970
 *             The log-evidence computed via Laplace approximation at the MAP estimate.
 *         '''
 *         logP_MAPs = infer_result['log_posterior']             # <<<<<<<<<<<<<<
 *         A = self.latent_hessian(obs, fltr, Tf, infer_result, contactMatrix,
 *                 generator, intervention_fun, tangent, eps, fd_method,
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_log_posterior); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_logP_MAPs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2971
 *         '''
 *         logP_MAPs = infer_result['log_posterior']
 *         A = self.latent_hessian(obs, fltr, Tf, infer_result, contactMatrix,             # <<<<<<<<<<<<<<
 *                 generator, intervention_fun, tangent, eps, fd_method,
 *                 inter_steps)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latent_hessian); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pyross/inference.pyx":2973
 *         A = self.latent_hessian(obs, fltr, Tf, infer_result, contactMatrix,
 *                 generator, intervention_fun, tangent, eps, fd_method,
 *                 inter_steps)             # <<<<<<<<<<<<<<
 *         k = A.shape[0]
 * 
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[12] = {__pyx_t_3, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 11+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2971, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[12] = {__pyx_t_3, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_eps, __pyx_v_fd_method, __pyx_v_inter_steps};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 11+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2971, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(11+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_obs);
    __Pyx_INCREF(__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_fltr);
    __Pyx_INCREF(__pyx_v_Tf);
    __Pyx_GIVEREF(__pyx_v_Tf);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_Tf);
    __Pyx_INCREF(__pyx_v_infer_result);
    __Pyx_GIVEREF(__pyx_v_infer_result);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_infer_result);
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_intervention_fun);
    __Pyx_INCREF(__pyx_v_tangent);
    __Pyx_GIVEREF(__pyx_v_tangent);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_tangent);
    __Pyx_INCREF(__pyx_v_eps);
    __Pyx_GIVEREF(__pyx_v_eps);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_eps);
    __Pyx_INCREF(__pyx_v_fd_method);
    __Pyx_GIVEREF(__pyx_v_fd_method);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_fd_method);
    __Pyx_INCREF(__pyx_v_inter_steps);
    __Pyx_GIVEREF(__pyx_v_inter_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_inter_steps);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_A = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":2974
 *                 generator, intervention_fun, tangent, eps, fd_method,
 *                 inter_steps)
 *         k = A.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return logP_MAPs - 0.5*np.log(np.linalg.det(A)) + 0.5*k*np.log(2*np.pi)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_k = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2976
 *         k = A.shape[0]
 * 
 *         return logP_MAPs - 0.5*np.log(np.linalg.det(A)) + 0.5*k*np.log(2*np.pi)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linalg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_det); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_logP_MAPs, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2926
 * 
 * 
 *     def latent_evidence_laplace(self, obs, fltr, Tf, infer_result, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        eps=None, fd_method="central", inter_steps=100):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SIR_type.latent_evidence_laplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logP_MAPs);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":2979
 * 
 * 
 *     def minus_logp_red(self, parameters, np.ndarray x0, np.ndarray obs,             # <<<<<<<<<<<<<<
 *                             np.ndarray fltr, double Tf, contactMatrix, tangent=False):
 *         '''Computes -logp for a latent trajectory
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_97minus_logp_red(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_96minus_logp_red[] = "Computes -logp for a latent trajectory\n\n        Parameters\n        ----------\n        parameters: dict\n            A dictionary of parameter values, same as the ones required for initialisation.\n        x0: numpy.array\n            Initial conditions\n        obs: numpy.array\n            The observed trajectory without the initial datapoint\n        fltr: boolean sequence or array\n            True for observed and False for unobserved.\n            e.g. if only Is is known for SIR with one age group, fltr = [False, False, True]\n        Tf: float\n            The total time of the trajectory\n        contactMatrix: callable\n            A function that returns the contact matrix at time t (input).\n        tangent: bool, optional\n            Set to True to do inference in tangent space (might be less robust but a lot faster). Default is False.\n\n        Returns\n        -------\n        minus_logp: float\n            -log(p) for the observed trajectory with the given parameters and initial conditions\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_97minus_logp_red(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyArrayObject *__pyx_v_x0 = 0;
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_tangent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minus_logp_red (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_x0,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_contactMatrix,&__pyx_n_s_tangent,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};

    /* "pyross/inference.pyx":2980
 * 
 *     def minus_logp_red(self, parameters, np.ndarray x0, np.ndarray obs,
 *                             np.ndarray fltr, double Tf, contactMatrix, tangent=False):             # <<<<<<<<<<<<<<
 *         '''Computes -logp for a latent trajectory
 * 
 */
    values[6] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("minus_logp_red", 0, 6, 7, 1); __PYX_ERR(0, 2979, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("minus_logp_red", 0, 6, 7, 2); __PYX_ERR(0, 2979, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("minus_logp_red", 0, 6, 7, 3); __PYX_ERR(0, 2979, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("minus_logp_red", 0, 6, 7, 4); __PYX_ERR(0, 2979, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("minus_logp_red", 0, 6, 7, 5); __PYX_ERR(0, 2979, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minus_logp_red") < 0)) __PYX_ERR(0, 2979, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parameters = values[0];
    __pyx_v_x0 = ((PyArrayObject *)values[1]);
    __pyx_v_obs = ((PyArrayObject *)values[2]);
    __pyx_v_fltr = ((PyArrayObject *)values[3]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2980, __pyx_L3_error)
    __pyx_v_contactMatrix = values[5];
    __pyx_v_tangent = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("minus_logp_red", 0, 6, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2979, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.minus_logp_red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x0), __pyx_ptype_5numpy_ndarray, 1, "x0", 0))) __PYX_ERR(0, 2979, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 2979, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 2980, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_96minus_logp_red(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_parameters, __pyx_v_x0, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_contactMatrix, __pyx_v_tangent);

  /* "pyross/inference.pyx":2979
 * 
 * 
 *     def minus_logp_red(self, parameters, np.ndarray x0, np.ndarray obs,             # <<<<<<<<<<<<<<
 *                             np.ndarray fltr, double Tf, contactMatrix, tangent=False):
 *         '''Computes -logp for a latent trajectory
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_96minus_logp_red(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters, PyArrayObject *__pyx_v_x0, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_tangent) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_nClass;
  PyObject *__pyx_v_obs0 = NULL;
  PyObject *__pyx_v_x0_obs = NULL;
  double __pyx_v_minus_logp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_12;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj __pyx_t_13;
  __Pyx_RefNannySetupContext("minus_logp_red", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_obs);
  __Pyx_INCREF((PyObject *)__pyx_v_fltr);

  /* "pyross/inference.pyx":3008
 * 
 *         cdef double minus_log_p
 *         cdef Py_ssize_t nClass=int(self.dim/self.M)             # <<<<<<<<<<<<<<
 *         self.contactMatrix = contactMatrix
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)
 */
  __pyx_v_nClass = (__pyx_v_self->dim / __pyx_v_self->M);

  /* "pyross/inference.pyx":3009
 *         cdef double minus_log_p
 *         cdef Py_ssize_t nClass=int(self.dim/self.M)
 *         self.contactMatrix = contactMatrix             # <<<<<<<<<<<<<<
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)
 * 
 */
  __Pyx_INCREF(__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_v_contactMatrix);
  __Pyx_GOTREF(__pyx_v_self->contactMatrix);
  __Pyx_DECREF(__pyx_v_self->contactMatrix);
  __pyx_v_self->contactMatrix = __pyx_v_contactMatrix;

  /* "pyross/inference.pyx":3010
 *         cdef Py_ssize_t nClass=int(self.dim/self.M)
 *         self.contactMatrix = contactMatrix
 *         fltr, obs, obs0 = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 * 
 *         # check that x0 is consistent with obs0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_fltr), ((PyObject *)__pyx_v_obs)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_fltr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr));
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_fltr));
    __Pyx_INCREF(((PyObject *)__pyx_v_obs));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_obs));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3010, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 3010, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3010, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3010, __pyx_L1_error)
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_fltr, ((PyArrayObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_5));
  __pyx_t_5 = 0;
  __pyx_v_obs0 = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3013
 * 
 *         # check that x0 is consistent with obs0
 *         x0_obs = fltr[0].dot(x0)             # <<<<<<<<<<<<<<
 *         if not np.allclose(x0_obs, obs0):
 *             print('x0 not consistent with obs0. '
 */
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_fltr), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_v_x0)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_x0));
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_x0_obs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3014
 *         # check that x0 is consistent with obs0
 *         x0_obs = fltr[0].dot(x0)
 *         if not np.allclose(x0_obs, obs0):             # <<<<<<<<<<<<<<
 *             print('x0 not consistent with obs0. '
 *                   'Using x0 in the calculation of logp...')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_allclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x0_obs, __pyx_v_obs0};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3014, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x0_obs, __pyx_v_obs0};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3014, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x0_obs);
    __Pyx_GIVEREF(__pyx_v_x0_obs);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_x0_obs);
    __Pyx_INCREF(__pyx_v_obs0);
    __Pyx_GIVEREF(__pyx_v_obs0);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_obs0);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":3015
 *         x0_obs = fltr[0].dot(x0)
 *         if not np.allclose(x0_obs, obs0):
 *             print('x0 not consistent with obs0. '             # <<<<<<<<<<<<<<
 *                   'Using x0 in the calculation of logp...')
 *         self.set_params(parameters)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3014
 *         # check that x0 is consistent with obs0
 *         x0_obs = fltr[0].dot(x0)
 *         if not np.allclose(x0_obs, obs0):             # <<<<<<<<<<<<<<
 *             print('x0 not consistent with obs0. '
 *                   'Using x0 in the calculation of logp...')
 */
  }

  /* "pyross/inference.pyx":3017
 *             print('x0 not consistent with obs0. '
 *                   'Using x0 in the calculation of logp...')
 *         self.set_params(parameters)             # <<<<<<<<<<<<<<
 *         minus_logp = self._obtain_logp_for_lat_traj(x0, obs, fltr[1:], Tf, tangent)
 *         return minus_logp
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3018
 *                   'Using x0 in the calculation of logp...')
 *         self.set_params(parameters)
 *         minus_logp = self._obtain_logp_for_lat_traj(x0, obs, fltr[1:], Tf, tangent)             # <<<<<<<<<<<<<<
 *         return minus_logp
 * 
 */
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_x0), PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_obs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_fltr), 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3018, __pyx_L1_error)
  __pyx_t_13.__pyx_n = 1;
  __pyx_t_13.tangent = __pyx_v_tangent;
  __pyx_t_12 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_obtain_logp_for_lat_traj(__pyx_v_self, __pyx_t_10, __pyx_t_11, ((PyArrayObject *)__pyx_t_1), __pyx_v_Tf, &__pyx_t_13); 
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_minus_logp = __pyx_t_12;

  /* "pyross/inference.pyx":3019
 *         self.set_params(parameters)
 *         minus_logp = self._obtain_logp_for_lat_traj(x0, obs, fltr[1:], Tf, tangent)
 *         return minus_logp             # <<<<<<<<<<<<<<
 * 
 *     def sample_endpoints(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_minus_logp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":2979
 * 
 * 
 *     def minus_logp_red(self, parameters, np.ndarray x0, np.ndarray obs,             # <<<<<<<<<<<<<<
 *                             np.ndarray fltr, double Tf, contactMatrix, tangent=False):
 *         '''Computes -logp for a latent trajectory
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.minus_logp_red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obs0);
  __Pyx_XDECREF(__pyx_v_x0_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3021
 *         return minus_logp
 * 
 *     def sample_endpoints(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_99sample_endpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_99sample_endpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_nsamples = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tangent = 0;
  CYTHON_UNUSED PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sample_endpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_nsamples,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_inter_steps,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":3022
 * 
 *     def sample_endpoints(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,
 *                        generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                        inter_steps=100):
 *         cdef Py_ssize_t i
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_False);
    values[9] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_endpoints", 0, 5, 10, 1); __PYX_ERR(0, 3021, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_endpoints", 0, 5, 10, 2); __PYX_ERR(0, 3021, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_endpoints", 0, 5, 10, 3); __PYX_ERR(0, 3021, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsamples)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_endpoints", 0, 5, 10, 4); __PYX_ERR(0, 3021, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sample_endpoints") < 0)) __PYX_ERR(0, 3021, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_infer_result = values[3];
    __pyx_v_nsamples = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
    __pyx_v_tangent = values[8];
    __pyx_v_inter_steps = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sample_endpoints", 0, 5, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3021, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_endpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_98sample_endpoints(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_nsamples, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":3021
 *         return minus_logp
 * 
 *     def sample_endpoints(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_98sample_endpoints(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_tangent, CYTHON_UNUSED PyObject *__pyx_v_inter_steps) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_x0 = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_v_mean = NULL;
  PyObject *__pyx_v_cov = NULL;
  PyObject *__pyx_v_null_space = NULL;
  PyObject *__pyx_v_known_space = NULL;
  PyObject *__pyx_v_partial_inits = NULL;
  PyObject *__pyx_v_inits = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  long __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("sample_endpoints", 0);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_INCREF(__pyx_v_fltr);

  /* "pyross/inference.pyx":3025
 *                        inter_steps=100):
 *         cdef Py_ssize_t i
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 *         x0 = infer_result['x0'].copy()
 *         fltr, obs, _ = pyross.utils.process_latent_data(fltr, obs)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3025, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3025, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3025, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_intervention_fun);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3025, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3026
 *         cdef Py_ssize_t i
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         x0 = infer_result['x0'].copy()             # <<<<<<<<<<<<<<
 *         fltr, obs, _ = pyross.utils.process_latent_data(fltr, obs)
 *         self.set_params(infer_result['params_dict'])
 */
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_x0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_x0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3027
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         x0 = infer_result['x0'].copy()
 *         fltr, obs, _ = pyross.utils.process_latent_data(fltr, obs)             # <<<<<<<<<<<<<<
 *         self.set_params(infer_result['params_dict'])
 *         mean, cov, null_space, known_space = self._mean_cov_for_lat_endpoint(x0, obs, fltr[1:], Tf)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_process_latent_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_fltr, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_fltr);
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_obs);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3027, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 3027, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3027, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_fltr, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_obs, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v__ = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3028
 *         x0 = infer_result['x0'].copy()
 *         fltr, obs, _ = pyross.utils.process_latent_data(fltr, obs)
 *         self.set_params(infer_result['params_dict'])             # <<<<<<<<<<<<<<
 *         mean, cov, null_space, known_space = self._mean_cov_for_lat_endpoint(x0, obs, fltr[1:], Tf)
 *         partial_inits = np.random.multivariate_normal(mean, cov, nsamples)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_params_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3029
 *         fltr, obs, _ = pyross.utils.process_latent_data(fltr, obs)
 *         self.set_params(infer_result['params_dict'])
 *         mean, cov, null_space, known_space = self._mean_cov_for_lat_endpoint(x0, obs, fltr[1:], Tf)             # <<<<<<<<<<<<<<
 *         partial_inits = np.random.multivariate_normal(mean, cov, nsamples)
 *         inits = (null_space.T@partial_inits.T).T + known_space
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mean_cov_for_lat_endpoint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_fltr, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_x0, __pyx_v_obs, __pyx_t_3, __pyx_v_Tf};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3029, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_x0, __pyx_v_obs, __pyx_t_3, __pyx_v_Tf};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3029, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x0);
    __Pyx_GIVEREF(__pyx_v_x0);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_x0);
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_obs);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_Tf);
    __Pyx_GIVEREF(__pyx_v_Tf);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_4, __pyx_v_Tf);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3029, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_6,&__pyx_t_3,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3029, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_6,&__pyx_t_3,&__pyx_t_5};
    __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_8); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_8), 4) < 0) __PYX_ERR(0, 3029, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3029, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_mean = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_cov = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_null_space = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_known_space = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3030
 *         self.set_params(infer_result['params_dict'])
 *         mean, cov, null_space, known_space = self._mean_cov_for_lat_endpoint(x0, obs, fltr[1:], Tf)
 *         partial_inits = np.random.multivariate_normal(mean, cov, nsamples)             # <<<<<<<<<<<<<<
 *         inits = (null_space.T@partial_inits.T).T + known_space
 *         for i in range(nsamples):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_mean, __pyx_v_cov, __pyx_v_nsamples};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3030, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_mean, __pyx_v_cov, __pyx_v_nsamples};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3030, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_mean);
    __Pyx_GIVEREF(__pyx_v_mean);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_mean);
    __Pyx_INCREF(__pyx_v_cov);
    __Pyx_GIVEREF(__pyx_v_cov);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_cov);
    __Pyx_INCREF(__pyx_v_nsamples);
    __Pyx_GIVEREF(__pyx_v_nsamples);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_v_nsamples);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_partial_inits = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3031
 *         mean, cov, null_space, known_space = self._mean_cov_for_lat_endpoint(x0, obs, fltr[1:], Tf)
 *         partial_inits = np.random.multivariate_normal(mean, cov, nsamples)
 *         inits = (null_space.T@partial_inits.T).T + known_space             # <<<<<<<<<<<<<<
 *         for i in range(nsamples):
 *             while not self._all_positive(inits[i]):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_null_space, __pyx_n_s_T); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_partial_inits, __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v_known_space); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_inits = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":3032
 *         partial_inits = np.random.multivariate_normal(mean, cov, nsamples)
 *         inits = (null_space.T@partial_inits.T).T + known_space
 *         for i in range(nsamples):             # <<<<<<<<<<<<<<
 *             while not self._all_positive(inits[i]):
 *                 partial_inits = np.random.multivariate_normal(mean, cov)
 */
  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_v_nsamples); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3032, __pyx_L1_error)
  __pyx_t_10 = __pyx_t_9;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pyross/inference.pyx":3033
 *         inits = (null_space.T@partial_inits.T).T + known_space
 *         for i in range(nsamples):
 *             while not self._all_positive(inits[i]):             # <<<<<<<<<<<<<<
 *                 partial_inits = np.random.multivariate_normal(mean, cov)
 *                 inits[i] = (null_space.T@partial_inits) + known_space
 */
    while (1) {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_all_positive); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_inits, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 3033, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_13 = ((!__pyx_t_12) != 0);
      if (!__pyx_t_13) break;

      /* "pyross/inference.pyx":3034
 *         for i in range(nsamples):
 *             while not self._all_positive(inits[i]):
 *                 partial_inits = np.random.multivariate_normal(mean, cov)             # <<<<<<<<<<<<<<
 *                 inits[i] = (null_space.T@partial_inits) + known_space
 *         return inits
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_mean, __pyx_v_cov};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3034, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_mean, __pyx_v_cov};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3034, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3034, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_1) {
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
        }
        __Pyx_INCREF(__pyx_v_mean);
        __Pyx_GIVEREF(__pyx_v_mean);
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_mean);
        __Pyx_INCREF(__pyx_v_cov);
        __Pyx_GIVEREF(__pyx_v_cov);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_cov);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3034, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_partial_inits, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pyross/inference.pyx":3035
 *             while not self._all_positive(inits[i]):
 *                 partial_inits = np.random.multivariate_normal(mean, cov)
 *                 inits[i] = (null_space.T@partial_inits) + known_space             # <<<<<<<<<<<<<<
 *         return inits
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_null_space, __pyx_n_s_T); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3035, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_6, __pyx_v_partial_inits); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3035, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v_known_space); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3035, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_SetItemInt(__pyx_v_inits, __pyx_v_i, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 3035, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }

  /* "pyross/inference.pyx":3036
 *                 partial_inits = np.random.multivariate_normal(mean, cov)
 *                 inits[i] = (null_space.T@partial_inits) + known_space
 *         return inits             # <<<<<<<<<<<<<<
 * 
 *     def sample_trajs(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_inits);
  __pyx_r = __pyx_v_inits;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3021
 *         return minus_logp
 * 
 *     def sample_endpoints(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_endpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_cov);
  __Pyx_XDECREF(__pyx_v_null_space);
  __Pyx_XDECREF(__pyx_v_known_space);
  __Pyx_XDECREF(__pyx_v_partial_inits);
  __Pyx_XDECREF(__pyx_v_inits);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_XDECREF(__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3038
 *         return inits
 * 
 *     def sample_trajs(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_101sample_trajs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_101sample_trajs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_Tf = 0;
  PyObject *__pyx_v_infer_result = 0;
  PyObject *__pyx_v_nsamples = 0;
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tangent = 0;
  CYTHON_UNUSED PyObject *__pyx_v_inter_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sample_trajs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_infer_result,&__pyx_n_s_nsamples,&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,&__pyx_n_s_tangent,&__pyx_n_s_inter_steps,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)Py_None);

    /* "pyross/inference.pyx":3039
 * 
 *     def sample_trajs(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,
 *                        generator=None, intervention_fun=None, tangent=False,             # <<<<<<<<<<<<<<
 *                        inter_steps=100):
 *         cdef Py_ssize_t i, Nf=obs.shape[0]
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_False);
    values[9] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_trajs", 0, 5, 10, 1); __PYX_ERR(0, 3038, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_trajs", 0, 5, 10, 2); __PYX_ERR(0, 3038, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infer_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_trajs", 0, 5, 10, 3); __PYX_ERR(0, 3038, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsamples)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sample_trajs", 0, 5, 10, 4); __PYX_ERR(0, 3038, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sample_trajs") < 0)) __PYX_ERR(0, 3038, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obs = values[0];
    __pyx_v_fltr = values[1];
    __pyx_v_Tf = values[2];
    __pyx_v_infer_result = values[3];
    __pyx_v_nsamples = values[4];
    __pyx_v_contactMatrix = values[5];
    __pyx_v_generator = values[6];
    __pyx_v_intervention_fun = values[7];
    __pyx_v_tangent = values[8];
    __pyx_v_inter_steps = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sample_trajs", 0, 5, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3038, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_trajs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_100sample_trajs(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_infer_result, __pyx_v_nsamples, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun, __pyx_v_tangent, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":3038
 *         return inits
 * 
 *     def sample_trajs(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_100sample_trajs(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_obs, PyObject *__pyx_v_fltr, PyObject *__pyx_v_Tf, PyObject *__pyx_v_infer_result, PyObject *__pyx_v_nsamples, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun, CYTHON_UNUSED PyObject *__pyx_v_tangent, CYTHON_UNUSED PyObject *__pyx_v_inter_steps) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_Nf;
  PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_v_mean = NULL;
  PyObject *__pyx_v_cov = NULL;
  PyObject *__pyx_v_full_null_space = NULL;
  PyObject *__pyx_v_known_space = NULL;
  PyObject *__pyx_v_trajs = NULL;
  PyObject *__pyx_v_partial_trajs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("sample_trajs", 0);
  __Pyx_INCREF(__pyx_v_fltr);

  /* "pyross/inference.pyx":3041
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 *         cdef Py_ssize_t i, Nf=obs.shape[0]             # <<<<<<<<<<<<<<
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         x0 = infer_result['x0'].copy()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_Nf = __pyx_t_3;

  /* "pyross/inference.pyx":3042
 *                        inter_steps=100):
 *         cdef Py_ssize_t i, Nf=obs.shape[0]
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)             # <<<<<<<<<<<<<<
 *         x0 = infer_result['x0'].copy()
 *         fltr = pyross.utils.process_fltr(fltr, Nf)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_process_contact_matrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3042, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3042, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_contactMatrix);
    __Pyx_INCREF(__pyx_v_generator);
    __Pyx_GIVEREF(__pyx_v_generator);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_generator);
    __Pyx_INCREF(__pyx_v_intervention_fun);
    __Pyx_GIVEREF(__pyx_v_intervention_fun);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_intervention_fun);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3043
 *         cdef Py_ssize_t i, Nf=obs.shape[0]
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         x0 = infer_result['x0'].copy()             # <<<<<<<<<<<<<<
 *         fltr = pyross.utils.process_fltr(fltr, Nf)
 *         self.set_params(infer_result['params_dict'])
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_x0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_x0 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3044
 *         self._process_contact_matrix(contactMatrix, generator, intervention_fun)
 *         x0 = infer_result['x0'].copy()
 *         fltr = pyross.utils.process_fltr(fltr, Nf)             # <<<<<<<<<<<<<<
 *         self.set_params(infer_result['params_dict'])
 *         mean, cov, full_null_space, known_space = self._mean_cov_for_lat_traj(x0, obs[1:], fltr[1:], Tf)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyross); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_process_fltr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_fltr, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_fltr, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_v_fltr);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_fltr);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_fltr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3045
 *         x0 = infer_result['x0'].copy()
 *         fltr = pyross.utils.process_fltr(fltr, Nf)
 *         self.set_params(infer_result['params_dict'])             # <<<<<<<<<<<<<<
 *         mean, cov, full_null_space, known_space = self._mean_cov_for_lat_traj(x0, obs[1:], fltr[1:], Tf)
 *         trajs = np.full((nsamples, (Nf-1), self.dim), -1, dtype=DTYPE)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_infer_result, __pyx_n_u_params_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3046
 *         fltr = pyross.utils.process_fltr(fltr, Nf)
 *         self.set_params(infer_result['params_dict'])
 *         mean, cov, full_null_space, known_space = self._mean_cov_for_lat_traj(x0, obs[1:], fltr[1:], Tf)             # <<<<<<<<<<<<<<
 *         trajs = np.full((nsamples, (Nf-1), self.dim), -1, dtype=DTYPE)
 *         for i in range(nsamples):
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mean_cov_for_lat_traj); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_obs, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_fltr, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_x0, __pyx_t_7, __pyx_t_1, __pyx_v_Tf};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3046, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_x0, __pyx_t_7, __pyx_t_1, __pyx_v_Tf};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3046, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x0);
    __Pyx_GIVEREF(__pyx_v_x0);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_5, __pyx_v_x0);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_5, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_5, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_Tf);
    __Pyx_GIVEREF(__pyx_v_Tf);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_5, __pyx_v_Tf);
    __pyx_t_7 = 0;
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3046, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_7);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_8,&__pyx_t_1,&__pyx_t_7};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3046, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_8,&__pyx_t_1,&__pyx_t_7};
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_9(__pyx_t_4); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 4) < 0) __PYX_ERR(0, 3046, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3046, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_mean = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_cov = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_full_null_space = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_known_space = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":3047
 *         self.set_params(infer_result['params_dict'])
 *         mean, cov, full_null_space, known_space = self._mean_cov_for_lat_traj(x0, obs[1:], fltr[1:], Tf)
 *         trajs = np.full((nsamples, (Nf-1), self.dim), -1, dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         for i in range(nsamples):
 *             while not all(map(self._all_positive, trajs[i])):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_full); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_nsamples);
  __Pyx_GIVEREF(__pyx_v_nsamples);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_nsamples);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_neg_1);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_trajs = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3048
 *         mean, cov, full_null_space, known_space = self._mean_cov_for_lat_traj(x0, obs[1:], fltr[1:], Tf)
 *         trajs = np.full((nsamples, (Nf-1), self.dim), -1, dtype=DTYPE)
 *         for i in range(nsamples):             # <<<<<<<<<<<<<<
 *             while not all(map(self._all_positive, trajs[i])):
 *                 partial_trajs = np.random.multivariate_normal(mean, cov)
 */
  __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_nsamples); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3048, __pyx_L1_error)
  __pyx_t_11 = __pyx_t_10;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pyross/inference.pyx":3049
 *         trajs = np.full((nsamples, (Nf-1), self.dim), -1, dtype=DTYPE)
 *         for i in range(nsamples):
 *             while not all(map(self._all_positive, trajs[i])):             # <<<<<<<<<<<<<<
 *                 partial_trajs = np.random.multivariate_normal(mean, cov)
 *                 trajs[i] = (full_null_space.T@partial_trajs + known_space).reshape((Nf-1, self.dim))
 */
    while (1) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_all_positive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_trajs, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
      __pyx_t_2 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 3049, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = ((!__pyx_t_12) != 0);
      if (!__pyx_t_13) break;

      /* "pyross/inference.pyx":3050
 *         for i in range(nsamples):
 *             while not all(map(self._all_positive, trajs[i])):
 *                 partial_trajs = np.random.multivariate_normal(mean, cov)             # <<<<<<<<<<<<<<
 *                 trajs[i] = (full_null_space.T@partial_trajs + known_space).reshape((Nf-1, self.dim))
 *         return trajs
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_random); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_mean, __pyx_v_cov};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3050, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_mean, __pyx_v_cov};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3050, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3050, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_v_mean);
        __Pyx_GIVEREF(__pyx_v_mean);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_mean);
        __Pyx_INCREF(__pyx_v_cov);
        __Pyx_GIVEREF(__pyx_v_cov);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_v_cov);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3050, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_partial_trajs, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":3051
 *             while not all(map(self._all_positive, trajs[i])):
 *                 partial_trajs = np.random.multivariate_normal(mean, cov)
 *                 trajs[i] = (full_null_space.T@partial_trajs + known_space).reshape((Nf-1, self.dim))             # <<<<<<<<<<<<<<
 *         return trajs
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_full_null_space, __pyx_n_s_T); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_8, __pyx_v_partial_trajs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_known_space); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_reshape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(__Pyx_SetItemInt(__pyx_v_trajs, __pyx_v_i, __pyx_t_1, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 3051, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }

  /* "pyross/inference.pyx":3052
 *                 partial_trajs = np.random.multivariate_normal(mean, cov)
 *                 trajs[i] = (full_null_space.T@partial_trajs + known_space).reshape((Nf-1, self.dim))
 *         return trajs             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_trajs);
  __pyx_r = __pyx_v_trajs;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3038
 *         return inits
 * 
 *     def sample_trajs(self, obs, fltr, Tf, infer_result, nsamples, contactMatrix=None,             # <<<<<<<<<<<<<<
 *                        generator=None, intervention_fun=None, tangent=False,
 *                        inter_steps=100):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyross.inference.SIR_type.sample_trajs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_mean);
  __Pyx_XDECREF(__pyx_v_cov);
  __Pyx_XDECREF(__pyx_v_full_null_space);
  __Pyx_XDECREF(__pyx_v_known_space);
  __Pyx_XDECREF(__pyx_v_trajs);
  __Pyx_XDECREF(__pyx_v_partial_trajs);
  __Pyx_XDECREF(__pyx_v_fltr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3055
 * 
 * 
 *     def get_mean_inits(self, init_priors, np.ndarray obs0, np.ndarray fltr0):             # <<<<<<<<<<<<<<
 *         '''Construct full initial conditions from the prior dict
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_103get_mean_inits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_102get_mean_inits[] = "Construct full initial conditions from the prior dict\n\n        Parameters\n        ----------\n        init_priors: dict\n            A dictionary for priors for initial conditions.\n            Same as the `init_priors` passed to `latent_infer`.\n            In this function, only takes the mean.\n        obs0: numpy.array\n            Observed initial conditions.\n        fltr0: numpy.array\n            Filter for the observed initial conditions.\n\n        Returns\n        -------\n        x0: numpy.array\n            Full initial conditions.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_103get_mean_inits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_init_priors = 0;
  PyArrayObject *__pyx_v_obs0 = 0;
  PyArrayObject *__pyx_v_fltr0 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mean_inits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_init_priors,&__pyx_n_s_obs0,&__pyx_n_s_fltr0,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_priors)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_mean_inits", 1, 3, 3, 1); __PYX_ERR(0, 3055, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_mean_inits", 1, 3, 3, 2); __PYX_ERR(0, 3055, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_mean_inits") < 0)) __PYX_ERR(0, 3055, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_init_priors = values[0];
    __pyx_v_obs0 = ((PyArrayObject *)values[1]);
    __pyx_v_fltr0 = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_mean_inits", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3055, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.get_mean_inits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs0), __pyx_ptype_5numpy_ndarray, 1, "obs0", 0))) __PYX_ERR(0, 3055, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr0), __pyx_ptype_5numpy_ndarray, 1, "fltr0", 0))) __PYX_ERR(0, 3055, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_102get_mean_inits(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_init_priors, __pyx_v_obs0, __pyx_v_fltr0);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_102get_mean_inits(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_init_priors, PyArrayObject *__pyx_v_obs0, PyArrayObject *__pyx_v_fltr0) {
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_v_init_mean = NULL;
  PyObject *__pyx_v_init_flags = NULL;
  PyObject *__pyx_v_init_fltrs = NULL;
  PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  __Pyx_RefNannySetupContext("get_mean_inits", 0);

  /* "pyross/inference.pyx":3075
 *         '''
 *         _, init_mean, _, _, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))             # <<<<<<<<<<<<<<
 *         x0 = self._construct_inits(init_mean, init_flags, init_fltrs, obs0, fltr0)
 *         return x0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_parse_init_prior_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_obs0)); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3075, __pyx_L1_error)
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_init_priors, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_init_priors, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_v_init_priors);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_init_priors);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3074, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_9);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_2,&__pyx_t_8,&__pyx_t_5,&__pyx_t_3,&__pyx_t_6,&__pyx_t_9};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3074, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_2,&__pyx_t_8,&__pyx_t_5,&__pyx_t_3,&__pyx_t_6,&__pyx_t_9};
    __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 6) < 0) __PYX_ERR(0, 3074, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3074, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "pyross/inference.pyx":3074
 *             Full initial conditions.
 *         '''
 *         _, init_mean, _, _, init_flags, init_fltrs \             # <<<<<<<<<<<<<<
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 *         x0 = self._construct_inits(init_mean, init_flags, init_fltrs, obs0, fltr0)
 */
  __pyx_v__ = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_init_mean = __pyx_t_8;
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v__, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v__, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_init_flags = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_init_fltrs = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":3076
 *         _, init_mean, _, _, init_flags, init_fltrs \
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 *         x0 = self._construct_inits(init_mean, init_flags, init_fltrs, obs0, fltr0)             # <<<<<<<<<<<<<<
 *         return x0
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_construct_inits); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_init_mean, __pyx_v_init_flags, __pyx_v_init_fltrs, ((PyObject *)__pyx_v_obs0), ((PyObject *)__pyx_v_fltr0)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3076, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_init_mean, __pyx_v_init_flags, __pyx_v_init_fltrs, ((PyObject *)__pyx_v_obs0), ((PyObject *)__pyx_v_fltr0)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3076, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_init_mean);
    __Pyx_GIVEREF(__pyx_v_init_mean);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_v_init_mean);
    __Pyx_INCREF(__pyx_v_init_flags);
    __Pyx_GIVEREF(__pyx_v_init_flags);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_v_init_flags);
    __Pyx_INCREF(__pyx_v_init_fltrs);
    __Pyx_GIVEREF(__pyx_v_init_fltrs);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_7, __pyx_v_init_fltrs);
    __Pyx_INCREF(((PyObject *)__pyx_v_obs0));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_obs0));
    PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_7, ((PyObject *)__pyx_v_obs0));
    __Pyx_INCREF(((PyObject *)__pyx_v_fltr0));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_fltr0));
    PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_7, ((PyObject *)__pyx_v_fltr0));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_x0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3077
 *             = pyross.utils.parse_init_prior_dict(init_priors, self.dim, len(obs0))
 *         x0 = self._construct_inits(init_mean, init_flags, init_fltrs, obs0, fltr0)
 *         return x0             # <<<<<<<<<<<<<<
 * 
 *     cpdef find_fastest_growing_lin_mode(self, double t):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_x0);
  __pyx_r = __pyx_v_x0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3055
 * 
 * 
 *     def get_mean_inits(self, init_priors, np.ndarray obs0, np.ndarray fltr0):             # <<<<<<<<<<<<<<
 *         '''Construct full initial conditions from the prior dict
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type.get_mean_inits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_init_mean);
  __Pyx_XDECREF(__pyx_v_init_flags);
  __Pyx_XDECREF(__pyx_v_init_fltrs);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3079
 *         return x0
 * 
 *     cpdef find_fastest_growing_lin_mode(self, double t):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray [DTYPE_t, ndim=1] x0
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_105find_fastest_growing_lin_mode(PyObject *__pyx_v_self, PyObject *__pyx_arg_t); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_find_fastest_growing_lin_mode(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, double __pyx_v_t, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_x0 = 0;
  Py_ssize_t __pyx_v_S_index;
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_v_sign = NULL;
  PyObject *__pyx_v_eigvec = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x0;
  __Pyx_Buffer __pyx_pybuffer_x0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  int __pyx_t_16;
  __Pyx_RefNannySetupContext("find_fastest_growing_lin_mode", 0);
  __pyx_pybuffer_x0.pybuffer.buf = NULL;
  __pyx_pybuffer_x0.refcount = 0;
  __pyx_pybuffernd_x0.data = NULL;
  __pyx_pybuffernd_x0.rcbuffer = &__pyx_pybuffer_x0;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_find_fastest_growing_lin_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_105find_fastest_growing_lin_mode)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3079, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __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);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3079, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3082
 *         cdef:
 *             np.ndarray [DTYPE_t, ndim=1] x0
 *             Py_ssize_t S_index, M=self.M             # <<<<<<<<<<<<<<
 *         # assume no infected at the start and compute eig vecs for the infectious species
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 */
  __pyx_t_6 = __pyx_v_self->M;
  __pyx_v_M = __pyx_t_6;

  /* "pyross/inference.pyx":3084
 *             Py_ssize_t S_index, M=self.M
 *         # assume no infected at the start and compute eig vecs for the infectious species
 *         x0 = np.zeros((self.dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         S_index = self.class_index_dict['S']
 *         x0[S_index*M:(S_index+1)*M] = self.fi
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3084, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_v_x0, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0;
    }
    __pyx_pybuffernd_x0.diminfo[0].strides = __pyx_pybuffernd_x0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x0.diminfo[0].shape = __pyx_pybuffernd_x0.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3084, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_x0 = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3085
 *         # assume no infected at the start and compute eig vecs for the infectious species
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 *         S_index = self.class_index_dict['S']             # <<<<<<<<<<<<<<
 *         x0[S_index*M:(S_index+1)*M] = self.fi
 *         self.compute_jacobian_and_b_matrix(x0, t,
 */
  if (unlikely(__pyx_v_self->class_index_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 3085, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->class_index_dict, __pyx_n_u_S); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3085, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_S_index = __pyx_t_6;

  /* "pyross/inference.pyx":3086
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 *         S_index = self.class_index_dict['S']
 *         x0[S_index*M:(S_index+1)*M] = self.fi             # <<<<<<<<<<<<<<
 *         self.compute_jacobian_and_b_matrix(x0, t,
 *                                            b_matrix=False, jacobian=True)
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->fi);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_S_index * __pyx_v_M)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyInt_FromSsize_t(((__pyx_v_S_index + 1) * __pyx_v_M)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PySlice_New(__pyx_t_1, __pyx_t_4, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_x0), __pyx_t_2, __pyx_t_3) < 0)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3087
 *         S_index = self.class_index_dict['S']
 *         x0[S_index*M:(S_index+1)*M] = self.fi
 *         self.compute_jacobian_and_b_matrix(x0, t,             # <<<<<<<<<<<<<<
 *                                            b_matrix=False, jacobian=True)
 *         sign, eigvec = pyross.utils.largest_real_eig(self.J_mat)
 */
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_x0), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3087, __pyx_L1_error)

  /* "pyross/inference.pyx":3088
 *         x0[S_index*M:(S_index+1)*M] = self.fi
 *         self.compute_jacobian_and_b_matrix(x0, t,
 *                                            b_matrix=False, jacobian=True)             # <<<<<<<<<<<<<<
 *         sign, eigvec = pyross.utils.largest_real_eig(self.J_mat)
 *         if not sign: # if eigval not positive, just return the zero state
 */
  __pyx_t_13.__pyx_n = 2;
  __pyx_t_13.b_matrix = Py_False;
  __pyx_t_13.jacobian = Py_True;
  __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->compute_jacobian_and_b_matrix(__pyx_v_self, __pyx_t_12, __pyx_v_t, &__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3089
 *         self.compute_jacobian_and_b_matrix(x0, t,
 *                                            b_matrix=False, jacobian=True)
 *         sign, eigvec = pyross.utils.largest_real_eig(self.J_mat)             # <<<<<<<<<<<<<<
 *         if not sign: # if eigval not positive, just return the zero state
 *             return np.zeros(self.dim)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_largest_real_eig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_v_self->J_mat)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self->J_mat));
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3089, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_14(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_14(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_1), 2) < 0) __PYX_ERR(0, 3089, __pyx_L1_error)
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3089, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_sign = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_eigvec = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3090
 *                                            b_matrix=False, jacobian=True)
 *         sign, eigvec = pyross.utils.largest_real_eig(self.J_mat)
 *         if not sign: # if eigval not positive, just return the zero state             # <<<<<<<<<<<<<<
 *             return np.zeros(self.dim)
 *         else:
 */
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_v_sign); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __pyx_t_16 = ((!__pyx_t_15) != 0);
  if (__pyx_t_16) {

    /* "pyross/inference.pyx":3091
 *         sign, eigvec = pyross.utils.largest_real_eig(self.J_mat)
 *         if not sign: # if eigval not positive, just return the zero state
 *             return np.zeros(self.dim)             # <<<<<<<<<<<<<<
 *         else:
 *             if eigvec[S_index*M] > 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyross/inference.pyx":3090
 *                                            b_matrix=False, jacobian=True)
 *         sign, eigvec = pyross.utils.largest_real_eig(self.J_mat)
 *         if not sign: # if eigval not positive, just return the zero state             # <<<<<<<<<<<<<<
 *             return np.zeros(self.dim)
 *         else:
 */
  }

  /* "pyross/inference.pyx":3093
 *             return np.zeros(self.dim)
 *         else:
 *             if eigvec[S_index*M] > 0:             # <<<<<<<<<<<<<<
 *                 eigvec = - eigvec
 *             return eigvec/np.linalg.norm(eigvec, ord=1)
 */
  /*else*/ {
    __pyx_t_6 = (__pyx_v_S_index * __pyx_v_M);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_eigvec, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_16) {

      /* "pyross/inference.pyx":3094
 *         else:
 *             if eigvec[S_index*M] > 0:
 *                 eigvec = - eigvec             # <<<<<<<<<<<<<<
 *             return eigvec/np.linalg.norm(eigvec, ord=1)
 * 
 */
      __pyx_t_2 = PyNumber_Negative(__pyx_v_eigvec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3094, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_eigvec, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pyross/inference.pyx":3093
 *             return np.zeros(self.dim)
 *         else:
 *             if eigvec[S_index*M] > 0:             # <<<<<<<<<<<<<<
 *                 eigvec = - eigvec
 *             return eigvec/np.linalg.norm(eigvec, ord=1)
 */
    }

    /* "pyross/inference.pyx":3095
 *             if eigvec[S_index*M] > 0:
 *                 eigvec = - eigvec
 *             return eigvec/np.linalg.norm(eigvec, ord=1)             # <<<<<<<<<<<<<<
 * 
 *     def set_lyapunov_method(self, lyapunov_method, rtol=None):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_norm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_eigvec);
    __Pyx_GIVEREF(__pyx_v_eigvec);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_eigvec);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ord, __pyx_int_1) < 0) __PYX_ERR(0, 3095, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_eigvec, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "pyross/inference.pyx":3079
 *         return x0
 * 
 *     cpdef find_fastest_growing_lin_mode(self, double t):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray [DTYPE_t, ndim=1] x0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pyross.inference.SIR_type.find_fastest_growing_lin_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_sign);
  __Pyx_XDECREF(__pyx_v_eigvec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_105find_fastest_growing_lin_mode(PyObject *__pyx_v_self, PyObject *__pyx_arg_t); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_105find_fastest_growing_lin_mode(PyObject *__pyx_v_self, PyObject *__pyx_arg_t) {
  double __pyx_v_t;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_fastest_growing_lin_mode (wrapper)", 0);
  assert(__pyx_arg_t); {
    __pyx_v_t = __pyx_PyFloat_AsDouble(__pyx_arg_t); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3079, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.find_fastest_growing_lin_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_104find_fastest_growing_lin_mode(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((double)__pyx_v_t));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_104find_fastest_growing_lin_mode(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, double __pyx_v_t) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("find_fastest_growing_lin_mode", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pyross_9inference_8SIR_type_find_fastest_growing_lin_mode(__pyx_v_self, __pyx_v_t, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.find_fastest_growing_lin_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3097
 *             return eigvec/np.linalg.norm(eigvec, ord=1)
 * 
 *     def set_lyapunov_method(self, lyapunov_method, rtol=None):             # <<<<<<<<<<<<<<
 *         '''Sets the method used for deterministic integration for the SIR_type model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_107set_lyapunov_method(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_106set_lyapunov_method[] = "Sets the method used for deterministic integration for the SIR_type model\n\n        Parameters\n        ----------\n        lyapunov_method: str\n            The name of the integration method. Choose between 'LSODA', 'RK45', 'RK2' and 'euler'.\n        rtol: double, otional\n            relative tolerance of the integrator (default 1e-3)\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_107set_lyapunov_method(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_lyapunov_method (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_lyapunov_method") < 0)) __PYX_ERR(0, 3097, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lyapunov_method = values[0];
    __pyx_v_rtol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_lyapunov_method", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3097, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.set_lyapunov_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_106set_lyapunov_method(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_lyapunov_method, __pyx_v_rtol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_106set_lyapunov_method(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("set_lyapunov_method", 0);

  /* "pyross/inference.pyx":3107
 *             relative tolerance of the integrator (default 1e-3)
 *         '''
 *         if lyapunov_method not in ['LSODA', 'RK45', 'RK2', 'euler']:             # <<<<<<<<<<<<<<
 *             raise Exception('{} not implemented. Choose between LSODA, RK45, RK2 and euler'.format(lyapunov_method))
 *         self.lyapunov_method=lyapunov_method
 */
  __Pyx_INCREF(__pyx_v_lyapunov_method);
  __pyx_t_1 = __pyx_v_lyapunov_method;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_LSODA, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3107, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_RK45, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3107, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_RK2, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3107, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_euler, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3107, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":3108
 *         '''
 *         if lyapunov_method not in ['LSODA', 'RK45', 'RK2', 'euler']:
 *             raise Exception('{} not implemented. Choose between LSODA, RK45, RK2 and euler'.format(lyapunov_method))             # <<<<<<<<<<<<<<
 *         self.lyapunov_method=lyapunov_method
 *         if rtol is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_not_implemented_Choose_between, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_lyapunov_method) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_lyapunov_method);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 3108, __pyx_L1_error)

    /* "pyross/inference.pyx":3107
 *             relative tolerance of the integrator (default 1e-3)
 *         '''
 *         if lyapunov_method not in ['LSODA', 'RK45', 'RK2', 'euler']:             # <<<<<<<<<<<<<<
 *             raise Exception('{} not implemented. Choose between LSODA, RK45, RK2 and euler'.format(lyapunov_method))
 *         self.lyapunov_method=lyapunov_method
 */
  }

  /* "pyross/inference.pyx":3109
 *         if lyapunov_method not in ['LSODA', 'RK45', 'RK2', 'euler']:
 *             raise Exception('{} not implemented. Choose between LSODA, RK45, RK2 and euler'.format(lyapunov_method))
 *         self.lyapunov_method=lyapunov_method             # <<<<<<<<<<<<<<
 *         if rtol is not None:
 *             self.rtol_lyapunov = rtol
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_lyapunov_method))||((__pyx_v_lyapunov_method) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_lyapunov_method)->tp_name), 0))) __PYX_ERR(0, 3109, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_lyapunov_method;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->lyapunov_method);
  __Pyx_DECREF(__pyx_v_self->lyapunov_method);
  __pyx_v_self->lyapunov_method = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3110
 *             raise Exception('{} not implemented. Choose between LSODA, RK45, RK2 and euler'.format(lyapunov_method))
 *         self.lyapunov_method=lyapunov_method
 *         if rtol is not None:             # <<<<<<<<<<<<<<
 *             self.rtol_lyapunov = rtol
 * 
 */
  __pyx_t_3 = (__pyx_v_rtol != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":3111
 *         self.lyapunov_method=lyapunov_method
 *         if rtol is not None:
 *             self.rtol_lyapunov = rtol             # <<<<<<<<<<<<<<
 * 
 *     def set_det_method(self, det_method, rtol=None):
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_rtol); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3111, __pyx_L1_error)
    __pyx_v_self->rtol_lyapunov = __pyx_t_6;

    /* "pyross/inference.pyx":3110
 *             raise Exception('{} not implemented. Choose between LSODA, RK45, RK2 and euler'.format(lyapunov_method))
 *         self.lyapunov_method=lyapunov_method
 *         if rtol is not None:             # <<<<<<<<<<<<<<
 *             self.rtol_lyapunov = rtol
 * 
 */
  }

  /* "pyross/inference.pyx":3097
 *             return eigvec/np.linalg.norm(eigvec, ord=1)
 * 
 *     def set_lyapunov_method(self, lyapunov_method, rtol=None):             # <<<<<<<<<<<<<<
 *         '''Sets the method used for deterministic integration for the SIR_type model
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SIR_type.set_lyapunov_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3113
 *             self.rtol_lyapunov = rtol
 * 
 *     def set_det_method(self, det_method, rtol=None):             # <<<<<<<<<<<<<<
 *         '''Sets the method used for deterministic integration for the SIR_type model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_109set_det_method(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_108set_det_method[] = "Sets the method used for deterministic integration for the SIR_type model\n\n        Parameters\n        ----------\n        det_method: str\n            The name of the integration method. Choose between 'LSODA' and 'RK45'.\n        rtol: double, otional\n            relative tolerance of the integrator (default 1e-3)\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_109set_det_method(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_rtol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_method (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_det_method,&__pyx_n_s_rtol,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_det_method") < 0)) __PYX_ERR(0, 3113, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_det_method = values[0];
    __pyx_v_rtol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_det_method", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3113, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.set_det_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_108set_det_method(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_det_method, __pyx_v_rtol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_108set_det_method(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_det_method, PyObject *__pyx_v_rtol) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("set_det_method", 0);

  /* "pyross/inference.pyx":3123
 *             relative tolerance of the integrator (default 1e-3)
 *         '''
 *         if det_method not in ['LSODA', 'RK45']:             # <<<<<<<<<<<<<<
 *             raise Exception('{} not implemented. Choose between LSODA and RK45'.format(det_method))
 *         self.det_method=det_method
 */
  __Pyx_INCREF(__pyx_v_det_method);
  __pyx_t_1 = __pyx_v_det_method;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_LSODA, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3123, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_RK45, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3123, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":3124
 *         '''
 *         if det_method not in ['LSODA', 'RK45']:
 *             raise Exception('{} not implemented. Choose between LSODA and RK45'.format(det_method))             # <<<<<<<<<<<<<<
 *         self.det_method=det_method
 *         if rtol is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_not_implemented_Choose_between_2, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_det_method) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_det_method);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 3124, __pyx_L1_error)

    /* "pyross/inference.pyx":3123
 *             relative tolerance of the integrator (default 1e-3)
 *         '''
 *         if det_method not in ['LSODA', 'RK45']:             # <<<<<<<<<<<<<<
 *             raise Exception('{} not implemented. Choose between LSODA and RK45'.format(det_method))
 *         self.det_method=det_method
 */
  }

  /* "pyross/inference.pyx":3125
 *         if det_method not in ['LSODA', 'RK45']:
 *             raise Exception('{} not implemented. Choose between LSODA and RK45'.format(det_method))
 *         self.det_method=det_method             # <<<<<<<<<<<<<<
 *         if rtol is not None:
 *             self.rtol_det = rtol
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_det_method))||((__pyx_v_det_method) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_det_method)->tp_name), 0))) __PYX_ERR(0, 3125, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_det_method;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->det_method);
  __Pyx_DECREF(__pyx_v_self->det_method);
  __pyx_v_self->det_method = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3126
 *             raise Exception('{} not implemented. Choose between LSODA and RK45'.format(det_method))
 *         self.det_method=det_method
 *         if rtol is not None:             # <<<<<<<<<<<<<<
 *             self.rtol_det = rtol
 * 
 */
  __pyx_t_3 = (__pyx_v_rtol != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":3127
 *         self.det_method=det_method
 *         if rtol is not None:
 *             self.rtol_det = rtol             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_rtol); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3127, __pyx_L1_error)
    __pyx_v_self->rtol_det = __pyx_t_6;

    /* "pyross/inference.pyx":3126
 *             raise Exception('{} not implemented. Choose between LSODA and RK45'.format(det_method))
 *         self.det_method=det_method
 *         if rtol is not None:             # <<<<<<<<<<<<<<
 *             self.rtol_det = rtol
 * 
 */
  }

  /* "pyross/inference.pyx":3113
 *             self.rtol_lyapunov = rtol
 * 
 *     def set_det_method(self, det_method, rtol=None):             # <<<<<<<<<<<<<<
 *         '''Sets the method used for deterministic integration for the SIR_type model
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SIR_type.set_det_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3130
 * 
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         '''
 *         Sets the internal deterministic model with given epidemiological parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_111set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_110set_det_model[] = "\n        Sets the internal deterministic model with given epidemiological parameters\n\n        Parameters\n        ----------\n        parameters: dict\n            A dictionary of parameter values, same as the ones required for initialisation.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_111set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_110set_det_model(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_110set_det_model(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_det_model", 0);

  /* "pyross/inference.pyx":3139
 *             A dictionary of parameter values, same as the ones required for initialisation.
 *         '''
 *         raise NotImplementedError("Please Implement set_det_model in subclass")             # <<<<<<<<<<<<<<
 * 
 *     def set_contact_matrix(self, contactMatrix):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 3139, __pyx_L1_error)

  /* "pyross/inference.pyx":3130
 * 
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         '''
 *         Sets the internal deterministic model with given epidemiological parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.set_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3141
 *         raise NotImplementedError("Please Implement set_det_model in subclass")
 * 
 *     def set_contact_matrix(self, contactMatrix):             # <<<<<<<<<<<<<<
 *         '''
 *         Sets the internal contact matrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_113set_contact_matrix(PyObject *__pyx_v_self, PyObject *__pyx_v_contactMatrix); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_112set_contact_matrix[] = "\n        Sets the internal contact matrix\n\n        Parameters\n        ----------\n        contactMatrix: callable\n            A function that returns the contact matrix given time, with call\n            signature contactMatrix(t).\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_113set_contact_matrix(PyObject *__pyx_v_self, PyObject *__pyx_v_contactMatrix) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_contact_matrix (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_112set_contact_matrix(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyObject *)__pyx_v_contactMatrix));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_112set_contact_matrix(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_contactMatrix) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_contact_matrix", 0);

  /* "pyross/inference.pyx":3151
 *             signature contactMatrix(t).
 *         '''
 *         self.contactMatrix = contactMatrix             # <<<<<<<<<<<<<<
 * 
 *     def make_params_dict(self):
 */
  __Pyx_INCREF(__pyx_v_contactMatrix);
  __Pyx_GIVEREF(__pyx_v_contactMatrix);
  __Pyx_GOTREF(__pyx_v_self->contactMatrix);
  __Pyx_DECREF(__pyx_v_self->contactMatrix);
  __pyx_v_self->contactMatrix = __pyx_v_contactMatrix;

  /* "pyross/inference.pyx":3141
 *         raise NotImplementedError("Please Implement set_det_model in subclass")
 * 
 *     def set_contact_matrix(self, contactMatrix):             # <<<<<<<<<<<<<<
 *         '''
 *         Sets the internal contact matrix
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3153
 *         self.contactMatrix = contactMatrix
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError("Please Implement make_params_dict in subclass")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_115make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_115make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_114make_params_dict(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_114make_params_dict(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":3154
 * 
 *     def make_params_dict(self):
 *         raise NotImplementedError("Please Implement make_params_dict in subclass")             # <<<<<<<<<<<<<<
 * 
 *     def fill_params_dict(self, keys, params, return_additional_params=False):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 3154, __pyx_L1_error)

  /* "pyross/inference.pyx":3153
 *         self.contactMatrix = contactMatrix
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError("Please Implement make_params_dict in subclass")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3156
 *         raise NotImplementedError("Please Implement make_params_dict in subclass")
 * 
 *     def fill_params_dict(self, keys, params, return_additional_params=False):             # <<<<<<<<<<<<<<
 *         '''Returns a full dictionary for epidemiological parameters with some changed values
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_117fill_params_dict(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_116fill_params_dict[] = "Returns a full dictionary for epidemiological parameters with some changed values\n\n        Parameters\n        ----------\n        keys: list of String\n            A list of names of parameters to be changed.\n        params: numpy.array of list\n            An array of the same size as keys for the updated value.\n        return_additional_params: boolean, optional (default = False)\n            Handling of parameters that are not model parameters (e.g. control parameters). False: raise exception, True: return second dictionary with other parameters\n\n        Returns\n        -------\n        full_parameters: dict\n            A dictionary of epidemiological parameters.\n            For parameter names specified in `keys`, set the values to be the ones in `params`;\n            for the others, use the values stored in the class.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_117fill_params_dict(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_keys = 0;
  PyObject *__pyx_v_params = 0;
  PyObject *__pyx_v_return_additional_params = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fill_params_dict (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_keys,&__pyx_n_s_params,&__pyx_n_s_return_additional_params,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keys)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fill_params_dict", 0, 2, 3, 1); __PYX_ERR(0, 3156, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_additional_params);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_params_dict") < 0)) __PYX_ERR(0, 3156, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_keys = values[0];
    __pyx_v_params = values[1];
    __pyx_v_return_additional_params = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fill_params_dict", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3156, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.fill_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_116fill_params_dict(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_keys, __pyx_v_params, __pyx_v_return_additional_params);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_116fill_params_dict(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_keys, PyObject *__pyx_v_params, PyObject *__pyx_v_return_additional_params) {
  PyObject *__pyx_v_full_parameters = NULL;
  PyObject *__pyx_v_others = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("fill_params_dict", 0);

  /* "pyross/inference.pyx":3175
 *             for the others, use the values stored in the class.
 *         '''
 *         full_parameters = self.make_params_dict()             # <<<<<<<<<<<<<<
 *         others = {}
 *         for (i, k) in enumerate(keys):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_make_params_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_full_parameters = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3176
 *         '''
 *         full_parameters = self.make_params_dict()
 *         others = {}             # <<<<<<<<<<<<<<
 *         for (i, k) in enumerate(keys):
 *             if k in self.param_keys:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_others = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3177
 *         full_parameters = self.make_params_dict()
 *         others = {}
 *         for (i, k) in enumerate(keys):             # <<<<<<<<<<<<<<
 *             if k in self.param_keys:
 *                 full_parameters[k] = params[i]
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) {
    __pyx_t_2 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3177, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 3177, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 3177, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3177, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":3178
 *         others = {}
 *         for (i, k) in enumerate(keys):
 *             if k in self.param_keys:             # <<<<<<<<<<<<<<
 *                 full_parameters[k] = params[i]
 *             elif return_additional_params:
 */
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_k, __pyx_v_self->param_keys, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3178, __pyx_L1_error)
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {

      /* "pyross/inference.pyx":3179
 *         for (i, k) in enumerate(keys):
 *             if k in self.param_keys:
 *                 full_parameters[k] = params[i]             # <<<<<<<<<<<<<<
 *             elif return_additional_params:
 *                 others[k] = params[i]
 */
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_params, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(PyObject_SetItem(__pyx_v_full_parameters, __pyx_v_k, __pyx_t_3) < 0)) __PYX_ERR(0, 3179, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pyross/inference.pyx":3178
 *         others = {}
 *         for (i, k) in enumerate(keys):
 *             if k in self.param_keys:             # <<<<<<<<<<<<<<
 *                 full_parameters[k] = params[i]
 *             elif return_additional_params:
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":3180
 *             if k in self.param_keys:
 *                 full_parameters[k] = params[i]
 *             elif return_additional_params:             # <<<<<<<<<<<<<<
 *                 others[k] = params[i]
 *             else:
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_return_additional_params); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3180, __pyx_L1_error)
    if (likely(__pyx_t_7)) {

      /* "pyross/inference.pyx":3181
 *                 full_parameters[k] = params[i]
 *             elif return_additional_params:
 *                 others[k] = params[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 raise Exception('{} is not a parameter of the model'.format(k))
 */
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_params, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(PyDict_SetItem(__pyx_v_others, __pyx_v_k, __pyx_t_3) < 0)) __PYX_ERR(0, 3181, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pyross/inference.pyx":3180
 *             if k in self.param_keys:
 *                 full_parameters[k] = params[i]
 *             elif return_additional_params:             # <<<<<<<<<<<<<<
 *                 others[k] = params[i]
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":3183
 *                 others[k] = params[i]
 *             else:
 *                 raise Exception('{} is not a parameter of the model'.format(k))             # <<<<<<<<<<<<<<
 *         if return_additional_params:
 *             return full_parameters, others
 */
    /*else*/ {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_is_not_a_parameter_of_the_model, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_k) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_k);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 3183, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":3177
 *         full_parameters = self.make_params_dict()
 *         others = {}
 *         for (i, k) in enumerate(keys):             # <<<<<<<<<<<<<<
 *             if k in self.param_keys:
 *                 full_parameters[k] = params[i]
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3184
 *             else:
 *                 raise Exception('{} is not a parameter of the model'.format(k))
 *         if return_additional_params:             # <<<<<<<<<<<<<<
 *             return full_parameters, others
 *         else:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_return_additional_params); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3184, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":3185
 *                 raise Exception('{} is not a parameter of the model'.format(k))
 *         if return_additional_params:
 *             return full_parameters, others             # <<<<<<<<<<<<<<
 *         else:
 *             return full_parameters
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_full_parameters);
    __Pyx_GIVEREF(__pyx_v_full_parameters);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_full_parameters);
    __Pyx_INCREF(__pyx_v_others);
    __Pyx_GIVEREF(__pyx_v_others);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_others);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pyross/inference.pyx":3184
 *             else:
 *                 raise Exception('{} is not a parameter of the model'.format(k))
 *         if return_additional_params:             # <<<<<<<<<<<<<<
 *             return full_parameters, others
 *         else:
 */
  }

  /* "pyross/inference.pyx":3187
 *             return full_parameters, others
 *         else:
 *             return full_parameters             # <<<<<<<<<<<<<<
 * 
 *     def set_params(self, parameters):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_full_parameters);
    __pyx_r = __pyx_v_full_parameters;
    goto __pyx_L0;
  }

  /* "pyross/inference.pyx":3156
 *         raise NotImplementedError("Please Implement make_params_dict in subclass")
 * 
 *     def fill_params_dict(self, keys, params, return_additional_params=False):             # <<<<<<<<<<<<<<
 *         '''Returns a full dictionary for epidemiological parameters with some changed values
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SIR_type.fill_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_full_parameters);
  __Pyx_XDECREF(__pyx_v_others);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3189
 *             return full_parameters
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         '''Sets epidemiological parameters used for evaluating -log(p)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_119set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_118set_params[] = "Sets epidemiological parameters used for evaluating -log(p)\n\n        Parameters\n        ----------\n        parameters: dict\n            A dictionary containing all epidemiological parameters.\n            Same keys as the one used to initialise the class.\n\n        Notes\n        -----\n        Can use `fill_params_dict` to generate the full dictionary if only a few parameters are changed\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_119set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_params (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_118set_params(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_118set_params(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("set_params", 0);

  /* "pyross/inference.pyx":3202
 *         Can use `fill_params_dict` to generate the full dictionary if only a few parameters are changed
 *         '''
 *         self.set_det_model(parameters)             # <<<<<<<<<<<<<<
 *         self.beta = pyross.utils.age_dep_rates(parameters['beta'], self.M, 'beta')
 *         self.gIa = pyross.utils.age_dep_rates(parameters['gIa'], self.M, 'gIa')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3203
 *         '''
 *         self.set_det_model(parameters)
 *         self.beta = pyross.utils.age_dep_rates(parameters['beta'], self.M, 'beta')             # <<<<<<<<<<<<<<
 *         self.gIa = pyross.utils.age_dep_rates(parameters['gIa'], self.M, 'gIa')
 *         self.gIs = pyross.utils.age_dep_rates(parameters['gIs'], self.M, 'gIs')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_beta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_beta};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3203, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_beta};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3203, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_beta);
    __Pyx_GIVEREF(__pyx_n_u_beta);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_n_u_beta);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->beta);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->beta));
  __pyx_v_self->beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3204
 *         self.set_det_model(parameters)
 *         self.beta = pyross.utils.age_dep_rates(parameters['beta'], self.M, 'beta')
 *         self.gIa = pyross.utils.age_dep_rates(parameters['gIa'], self.M, 'gIa')             # <<<<<<<<<<<<<<
 *         self.gIs = pyross.utils.age_dep_rates(parameters['gIs'], self.M, 'gIs')
 *         self.fsa = pyross.utils.age_dep_rates(parameters['fsa'], self.M, 'fsa')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_gIa); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_7, __pyx_t_4, __pyx_n_u_gIa};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3204, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_7, __pyx_t_4, __pyx_n_u_gIa};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3204, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_gIa);
    __Pyx_GIVEREF(__pyx_n_u_gIa);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_n_u_gIa);
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3204, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gIa));
  __pyx_v_self->gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3205
 *         self.beta = pyross.utils.age_dep_rates(parameters['beta'], self.M, 'beta')
 *         self.gIa = pyross.utils.age_dep_rates(parameters['gIa'], self.M, 'gIa')
 *         self.gIs = pyross.utils.age_dep_rates(parameters['gIs'], self.M, 'gIs')             # <<<<<<<<<<<<<<
 *         self.fsa = pyross.utils.age_dep_rates(parameters['fsa'], self.M, 'fsa')
 *         self.alpha = pyross.utils.age_dep_rates(parameters['alpha'], self.M, 'alpha')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_gIs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_4, __pyx_n_u_gIs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3205, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_4, __pyx_n_u_gIs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3205, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_gIs);
    __Pyx_GIVEREF(__pyx_n_u_gIs);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_n_u_gIs);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gIs));
  __pyx_v_self->gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3206
 *         self.gIa = pyross.utils.age_dep_rates(parameters['gIa'], self.M, 'gIa')
 *         self.gIs = pyross.utils.age_dep_rates(parameters['gIs'], self.M, 'gIs')
 *         self.fsa = pyross.utils.age_dep_rates(parameters['fsa'], self.M, 'fsa')             # <<<<<<<<<<<<<<
 *         self.alpha = pyross.utils.age_dep_rates(parameters['alpha'], self.M, 'alpha')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_fsa); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_fsa};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3206, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_fsa};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3206, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_fsa);
    __Pyx_GIVEREF(__pyx_n_u_fsa);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_n_u_fsa);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->fsa));
  __pyx_v_self->fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3207
 *         self.gIs = pyross.utils.age_dep_rates(parameters['gIs'], self.M, 'gIs')
 *         self.fsa = pyross.utils.age_dep_rates(parameters['fsa'], self.M, 'fsa')
 *         self.alpha = pyross.utils.age_dep_rates(parameters['alpha'], self.M, 'alpha')             # <<<<<<<<<<<<<<
 * 
 *     def _construct_inits(self, init_guess, flags, fltrs, obs0, fltr0):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_alpha); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_7, __pyx_t_4, __pyx_n_u_alpha};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3207, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_7, __pyx_t_4, __pyx_n_u_alpha};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3207, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_alpha);
    __Pyx_GIVEREF(__pyx_n_u_alpha);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_n_u_alpha);
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->alpha));
  __pyx_v_self->alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3189
 *             return full_parameters
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         '''Sets epidemiological parameters used for evaluating -log(p)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SIR_type.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3209
 *         self.alpha = pyross.utils.age_dep_rates(parameters['alpha'], self.M, 'alpha')
 * 
 *     def _construct_inits(self, init_guess, flags, fltrs, obs0, fltr0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray [DTYPE_t, ndim=1] x0
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_121_construct_inits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_121_construct_inits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_init_guess = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_fltrs = 0;
  PyObject *__pyx_v_obs0 = 0;
  PyObject *__pyx_v_fltr0 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_construct_inits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_init_guess,&__pyx_n_s_flags,&__pyx_n_s_fltrs,&__pyx_n_s_obs0,&__pyx_n_s_fltr0,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_guess)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_construct_inits", 1, 5, 5, 1); __PYX_ERR(0, 3209, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltrs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_construct_inits", 1, 5, 5, 2); __PYX_ERR(0, 3209, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_construct_inits", 1, 5, 5, 3); __PYX_ERR(0, 3209, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_construct_inits", 1, 5, 5, 4); __PYX_ERR(0, 3209, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_construct_inits") < 0)) __PYX_ERR(0, 3209, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_init_guess = values[0];
    __pyx_v_flags = values[1];
    __pyx_v_fltrs = values[2];
    __pyx_v_obs0 = values[3];
    __pyx_v_fltr0 = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_construct_inits", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3209, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._construct_inits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_120_construct_inits(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_init_guess, __pyx_v_flags, __pyx_v_fltrs, __pyx_v_obs0, __pyx_v_fltr0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_120_construct_inits(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_init_guess, PyObject *__pyx_v_flags, PyObject *__pyx_v_fltrs, PyObject *__pyx_v_obs0, PyObject *__pyx_v_fltr0) {
  PyArrayObject *__pyx_v_x0 = 0;
  PyArrayObject *__pyx_v_F = 0;
  Py_ssize_t __pyx_v_start;
  PyObject *__pyx_v_coeff = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_F;
  __Pyx_Buffer __pyx_pybuffer_F;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_x0;
  __Pyx_Buffer __pyx_pybuffer_x0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyArrayObject *__pyx_t_12 = NULL;
  PyArrayObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("_construct_inits", 0);
  __pyx_pybuffer_x0.pybuffer.buf = NULL;
  __pyx_pybuffer_x0.refcount = 0;
  __pyx_pybuffernd_x0.data = NULL;
  __pyx_pybuffernd_x0.rcbuffer = &__pyx_pybuffer_x0;
  __pyx_pybuffer_F.pybuffer.buf = NULL;
  __pyx_pybuffer_F.refcount = 0;
  __pyx_pybuffernd_F.data = NULL;
  __pyx_pybuffernd_F.rcbuffer = &__pyx_pybuffer_F;

  /* "pyross/inference.pyx":3213
 *             np.ndarray [DTYPE_t, ndim=1] x0
 *             np.ndarray [DTYPE_t, ndim=2] F
 *             Py_ssize_t start=0             # <<<<<<<<<<<<<<
 *         x0 = obs0
 *         F = fltr0
 */
  __pyx_v_start = 0;

  /* "pyross/inference.pyx":3214
 *             np.ndarray [DTYPE_t, ndim=2] F
 *             Py_ssize_t start=0
 *         x0 = obs0             # <<<<<<<<<<<<<<
 *         F = fltr0
 *         if flags[0]: # lin mode
 */
  if (!(likely(((__pyx_v_obs0) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_obs0, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3214, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_obs0;
  __Pyx_INCREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_v_x0, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_x0.diminfo[0].strides = __pyx_pybuffernd_x0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x0.diminfo[0].shape = __pyx_pybuffernd_x0.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3214, __pyx_L1_error)
  }
  __pyx_v_x0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3215
 *             Py_ssize_t start=0
 *         x0 = obs0
 *         F = fltr0             # <<<<<<<<<<<<<<
 *         if flags[0]: # lin mode
 *             coeff = init_guess[0]
 */
  if (!(likely(((__pyx_v_fltr0) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fltr0, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3215, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_fltr0;
  __Pyx_INCREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_F.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_F.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_F.rcbuffer->pybuffer, (PyObject*)__pyx_v_F, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_F.diminfo[0].strides = __pyx_pybuffernd_F.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_F.diminfo[0].shape = __pyx_pybuffernd_F.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_F.diminfo[1].strides = __pyx_pybuffernd_F.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_F.diminfo[1].shape = __pyx_pybuffernd_F.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3215, __pyx_L1_error)
  }
  __pyx_v_F = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3216
 *         x0 = obs0
 *         F = fltr0
 *         if flags[0]: # lin mode             # <<<<<<<<<<<<<<
 *             coeff = init_guess[0]
 *             x0 = np.concatenate((x0, fltrs[0]@self._lin_mode_inits(coeff)))
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_flags, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":3217
 *         F = fltr0
 *         if flags[0]: # lin mode
 *             coeff = init_guess[0]             # <<<<<<<<<<<<<<
 *             x0 = np.concatenate((x0, fltrs[0]@self._lin_mode_inits(coeff)))
 *             F = np.concatenate((F, fltrs[0]), axis=0)
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_init_guess, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_coeff = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3218
 *         if flags[0]: # lin mode
 *             coeff = init_guess[0]
 *             x0 = np.concatenate((x0, fltrs[0]@self._lin_mode_inits(coeff)))             # <<<<<<<<<<<<<<
 *             F = np.concatenate((F, fltrs[0]), axis=0)
 *             start += 1
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fltrs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lin_mode_inits); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_v_coeff) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_coeff);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)__pyx_v_x0));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_x0));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_x0));
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3218, __pyx_L1_error)
    __pyx_t_12 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
      __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_2 < 0)) {
        PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_v_x0, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        }
        __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
      }
      __pyx_pybuffernd_x0.diminfo[0].strides = __pyx_pybuffernd_x0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x0.diminfo[0].shape = __pyx_pybuffernd_x0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3218, __pyx_L1_error)
    }
    __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_x0, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3219
 *             coeff = init_guess[0]
 *             x0 = np.concatenate((x0, fltrs[0]@self._lin_mode_inits(coeff)))
 *             F = np.concatenate((F, fltrs[0]), axis=0)             # <<<<<<<<<<<<<<
 *             start += 1
 *         if flags[1]: # independent guesses
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fltrs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)__pyx_v_F));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_F));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_F));
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 3219, __pyx_L1_error)
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3219, __pyx_L1_error)
    __pyx_t_13 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_F.rcbuffer->pybuffer);
      __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_F.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_2 < 0)) {
        PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_F.rcbuffer->pybuffer, (PyObject*)__pyx_v_F, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
        }
        __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
      }
      __pyx_pybuffernd_F.diminfo[0].strides = __pyx_pybuffernd_F.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_F.diminfo[0].shape = __pyx_pybuffernd_F.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_F.diminfo[1].strides = __pyx_pybuffernd_F.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_F.diminfo[1].shape = __pyx_pybuffernd_F.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3219, __pyx_L1_error)
    }
    __pyx_t_13 = 0;
    __Pyx_DECREF_SET(__pyx_v_F, ((PyArrayObject *)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":3220
 *             x0 = np.concatenate((x0, fltrs[0]@self._lin_mode_inits(coeff)))
 *             F = np.concatenate((F, fltrs[0]), axis=0)
 *             start += 1             # <<<<<<<<<<<<<<
 *         if flags[1]: # independent guesses
 *             x0 = np.concatenate((x0, init_guess[start:]))
 */
    __pyx_v_start = (__pyx_v_start + 1);

    /* "pyross/inference.pyx":3216
 *         x0 = obs0
 *         F = fltr0
 *         if flags[0]: # lin mode             # <<<<<<<<<<<<<<
 *             coeff = init_guess[0]
 *             x0 = np.concatenate((x0, fltrs[0]@self._lin_mode_inits(coeff)))
 */
  }

  /* "pyross/inference.pyx":3221
 *             F = np.concatenate((F, fltrs[0]), axis=0)
 *             start += 1
 *         if flags[1]: # independent guesses             # <<<<<<<<<<<<<<
 *             x0 = np.concatenate((x0, init_guess[start:]))
 *             F = np.concatenate((F, fltrs[1]), axis=0)
 */
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_flags, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":3222
 *             start += 1
 *         if flags[1]: # independent guesses
 *             x0 = np.concatenate((x0, init_guess[start:]))             # <<<<<<<<<<<<<<
 *             F = np.concatenate((F, fltrs[1]), axis=0)
 *         assert np.linalg.matrix_rank(F) == self.dim, 'Conflicts in initial conditions'
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_init_guess, __pyx_v_start, 0, NULL, NULL, NULL, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_x0));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_x0));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_x0));
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3222, __pyx_L1_error)
    __pyx_t_12 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
      __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_2 < 0)) {
        PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x0.rcbuffer->pybuffer, (PyObject*)__pyx_v_x0, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        }
        __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
      }
      __pyx_pybuffernd_x0.diminfo[0].strides = __pyx_pybuffernd_x0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x0.diminfo[0].shape = __pyx_pybuffernd_x0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3222, __pyx_L1_error)
    }
    __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_x0, ((PyArrayObject *)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "pyross/inference.pyx":3223
 *         if flags[1]: # independent guesses
 *             x0 = np.concatenate((x0, init_guess[start:]))
 *             F = np.concatenate((F, fltrs[1]), axis=0)             # <<<<<<<<<<<<<<
 *         assert np.linalg.matrix_rank(F) == self.dim, 'Conflicts in initial conditions'
 *         return np.linalg.solve(F, x0)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_fltrs, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_F));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_F));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_F));
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 3223, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3223, __pyx_L1_error)
    __pyx_t_13 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_F.rcbuffer->pybuffer);
      __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_F.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_2 < 0)) {
        PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_F.rcbuffer->pybuffer, (PyObject*)__pyx_v_F, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
        }
        __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
      }
      __pyx_pybuffernd_F.diminfo[0].strides = __pyx_pybuffernd_F.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_F.diminfo[0].shape = __pyx_pybuffernd_F.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_F.diminfo[1].strides = __pyx_pybuffernd_F.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_F.diminfo[1].shape = __pyx_pybuffernd_F.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3223, __pyx_L1_error)
    }
    __pyx_t_13 = 0;
    __Pyx_DECREF_SET(__pyx_v_F, ((PyArrayObject *)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":3221
 *             F = np.concatenate((F, fltrs[0]), axis=0)
 *             start += 1
 *         if flags[1]: # independent guesses             # <<<<<<<<<<<<<<
 *             x0 = np.concatenate((x0, init_guess[start:]))
 *             F = np.concatenate((F, fltrs[1]), axis=0)
 */
  }

  /* "pyross/inference.pyx":3224
 *             x0 = np.concatenate((x0, init_guess[start:]))
 *             F = np.concatenate((F, fltrs[1]), axis=0)
 *         assert np.linalg.matrix_rank(F) == self.dim, 'Conflicts in initial conditions'             # <<<<<<<<<<<<<<
 *         return np.linalg.solve(F, x0)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_linalg); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_matrix_rank); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, ((PyObject *)__pyx_v_F)) : __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)__pyx_v_F));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3224, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_6)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Conflicts_in_initial_conditions);
      __PYX_ERR(0, 3224, __pyx_L1_error)
    }
  }
  #endif

  /* "pyross/inference.pyx":3225
 *             F = np.concatenate((F, fltrs[1]), axis=0)
 *         assert np.linalg.matrix_rank(F) == self.dim, 'Conflicts in initial conditions'
 *         return np.linalg.solve(F, x0)             # <<<<<<<<<<<<<<
 * 
 *     def _lin_mode_inits(self, double coeff):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_linalg); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_solve); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_2 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_2 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_F), ((PyObject *)__pyx_v_x0)};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_10);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_F), ((PyObject *)__pyx_v_x0)};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_10);
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_F));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_F));
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_2, ((PyObject *)__pyx_v_F));
    __Pyx_INCREF(((PyObject *)__pyx_v_x0));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_x0));
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_2, ((PyObject *)__pyx_v_x0));
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3209
 *         self.alpha = pyross.utils.age_dep_rates(parameters['alpha'], self.M, 'alpha')
 * 
 *     def _construct_inits(self, init_guess, flags, fltrs, obs0, fltr0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray [DTYPE_t, ndim=1] x0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_F.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pyross.inference.SIR_type._construct_inits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_F.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x0.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x0);
  __Pyx_XDECREF((PyObject *)__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_coeff);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3227
 *         return np.linalg.solve(F, x0)
 * 
 *     def _lin_mode_inits(self, double coeff):             # <<<<<<<<<<<<<<
 *         cdef double [:] v, x0, fi=self.fi
 *         v = self.find_fastest_growing_lin_mode(0)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_123_lin_mode_inits(PyObject *__pyx_v_self, PyObject *__pyx_arg_coeff); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_123_lin_mode_inits(PyObject *__pyx_v_self, PyObject *__pyx_arg_coeff) {
  double __pyx_v_coeff;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_lin_mode_inits (wrapper)", 0);
  assert(__pyx_arg_coeff); {
    __pyx_v_coeff = __pyx_PyFloat_AsDouble(__pyx_arg_coeff); if (unlikely((__pyx_v_coeff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3227, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._lin_mode_inits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_122_lin_mode_inits(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((double)__pyx_v_coeff));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_122_lin_mode_inits(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, double __pyx_v_coeff) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_x0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("_lin_mode_inits", 0);

  /* "pyross/inference.pyx":3228
 * 
 *     def _lin_mode_inits(self, double coeff):
 *         cdef double [:] v, x0, fi=self.fi             # <<<<<<<<<<<<<<
 *         v = self.find_fastest_growing_lin_mode(0)
 *         v = np.multiply(v, coeff)
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3228, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3229
 *     def _lin_mode_inits(self, double coeff):
 *         cdef double [:] v, x0, fi=self.fi
 *         v = self.find_fastest_growing_lin_mode(0)             # <<<<<<<<<<<<<<
 *         v = np.multiply(v, coeff)
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->find_fastest_growing_lin_mode(__pyx_v_self, 0.0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3229, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_v = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3230
 *         cdef double [:] v, x0, fi=self.fi
 *         v = self.find_fastest_growing_lin_mode(0)
 *         v = np.multiply(v, coeff)             # <<<<<<<<<<<<<<
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 *         x0[:self.M] = fi
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_multiply); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_coeff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3230, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3230, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
  __pyx_v_v = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3231
 *         v = self.find_fastest_growing_lin_mode(0)
 *         v = np.multiply(v, coeff)
 *         x0 = np.zeros((self.dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         x0[:self.M] = fi
 *         return np.add(x0, v)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_x0 = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3232
 *         v = np.multiply(v, coeff)
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 *         x0[:self.M] = fi             # <<<<<<<<<<<<<<
 *         return np.add(x0, v)
 * 
 */
  __pyx_t_1.data = __pyx_v_x0.data;
  __pyx_t_1.memview = __pyx_v_x0.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_1, 0);
  __pyx_t_7 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_1,
    __pyx_v_x0.shape[0], __pyx_v_x0.strides[0], __pyx_v_x0.suboffsets[0],
    0,
    0,
    &__pyx_t_7,
    0,
    __pyx_v_self->M,
    0,
    0,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3232, __pyx_L1_error)
}

if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_fi, __pyx_t_1, 1, 1, 0) < 0)) __PYX_ERR(0, 3232, __pyx_L1_error)
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3233
 *         x0 = np.zeros((self.dim), dtype=DTYPE)
 *         x0[:self.M] = fi
 *         return np.add(x0, v)             # <<<<<<<<<<<<<<
 * 
 *     cdef double _obtain_logp_for_traj(self, double [:, :] x, double Tf,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_4};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3233, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_4};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3233, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3227
 *         return np.linalg.solve(F, x0)
 * 
 *     def _lin_mode_inits(self, double coeff):             # <<<<<<<<<<<<<<
 *         cdef double [:] v, x0, fi=self.fi
 *         v = self.find_fastest_growing_lin_mode(0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyross.inference.SIR_type._lin_mode_inits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3235
 *         return np.add(x0, v)
 * 
 *     cdef double _obtain_logp_for_traj(self, double [:, :] x, double Tf,             # <<<<<<<<<<<<<<
 *                                      Py_ssize_t inter_steps=0):
 *         cdef:
 */

static double __pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_traj(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_Tf, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj *__pyx_optional_args) {
  Py_ssize_t __pyx_v_inter_steps = ((Py_ssize_t)0);
  double __pyx_v_log_p;
  __Pyx_memviewslice __pyx_v_xi = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xf = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dev = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v__xm = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_Nf;
  Py_ssize_t __pyx_v_steps;
  __Pyx_memviewslice __pyx_v_time_points = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_ti = NULL;
  PyObject *__pyx_v_tf = NULL;
  PyObject *__pyx_v_times = NULL;
  PyObject *__pyx_v_sol = NULL;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_t_21;
  PyObject *(*__pyx_t_22)(PyObject *);
  double __pyx_t_23;
  double __pyx_t_24;
  __Pyx_RefNannySetupContext("_obtain_logp_for_traj", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_inter_steps = __pyx_optional_args->inter_steps;
    }
  }

  /* "pyross/inference.pyx":3238
 *                                      Py_ssize_t inter_steps=0):
 *         cdef:
 *             double log_p = 0             # <<<<<<<<<<<<<<
 *             double [:] xi, xf, dev
 *             double [:, :] cov, xm, _xm
 */
  __pyx_v_log_p = 0.0;

  /* "pyross/inference.pyx":3241
 *             double [:] xi, xf, dev
 *             double [:, :] cov, xm, _xm
 *             Py_ssize_t i, Nf=x.shape[0], steps=self.steps             # <<<<<<<<<<<<<<
 *             double [:] time_points = np.linspace(0, Tf, Nf)
 *         for i in range(Nf-1):
 */
  __pyx_v_Nf = (__pyx_v_x.shape[0]);
  __pyx_t_1 = __pyx_v_self->steps;
  __pyx_v_steps = __pyx_t_1;

  /* "pyross/inference.pyx":3242
 *             double [:, :] cov, xm, _xm
 *             Py_ssize_t i, Nf=x.shape[0], steps=self.steps
 *             double [:] time_points = np.linspace(0, Tf, Nf)             # <<<<<<<<<<<<<<
 *         for i in range(Nf-1):
 *             xi = x[i]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3242, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3242, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 3242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_time_points = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "pyross/inference.pyx":3243
 *             Py_ssize_t i, Nf=x.shape[0], steps=self.steps
 *             double [:] time_points = np.linspace(0, Tf, Nf)
 *         for i in range(Nf-1):             # <<<<<<<<<<<<<<
 *             xi = x[i]
 *             xf = x[i+1]
 */
  __pyx_t_1 = (__pyx_v_Nf - 1);
  __pyx_t_10 = __pyx_t_1;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pyross/inference.pyx":3244
 *             double [:] time_points = np.linspace(0, Tf, Nf)
 *         for i in range(Nf-1):
 *             xi = x[i]             # <<<<<<<<<<<<<<
 *             xf = x[i+1]
 *             ti = time_points[i]
 */
    __pyx_t_9.data = __pyx_v_x.data;
    __pyx_t_9.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_x.strides[0];
        if ((0)) __PYX_ERR(0, 3244, __pyx_L1_error)
        __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_9.shape[0] = __pyx_v_x.shape[1];
__pyx_t_9.strides[0] = __pyx_v_x.strides[1];
    __pyx_t_9.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xi, 1);
    __pyx_v_xi = __pyx_t_9;
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;

    /* "pyross/inference.pyx":3245
 *         for i in range(Nf-1):
 *             xi = x[i]
 *             xf = x[i+1]             # <<<<<<<<<<<<<<
 *             ti = time_points[i]
 *             tf = time_points[i+1]
 */
    __pyx_t_9.data = __pyx_v_x.data;
    __pyx_t_9.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
    {
    Py_ssize_t __pyx_tmp_idx = (__pyx_v_i + 1);
    Py_ssize_t __pyx_tmp_stride = __pyx_v_x.strides[0];
        if ((0)) __PYX_ERR(0, 3245, __pyx_L1_error)
        __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_9.shape[0] = __pyx_v_x.shape[1];
__pyx_t_9.strides[0] = __pyx_v_x.strides[1];
    __pyx_t_9.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xf, 1);
    __pyx_v_xf = __pyx_t_9;
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;

    /* "pyross/inference.pyx":3246
 *             xi = x[i]
 *             xf = x[i+1]
 *             ti = time_points[i]             # <<<<<<<<<<<<<<
 *             tf = time_points[i+1]
 *             if inter_steps:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_12 * __pyx_v_time_points.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_ti, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":3247
 *             xf = x[i+1]
 *             ti = time_points[i]
 *             tf = time_points[i+1]             # <<<<<<<<<<<<<<
 *             if inter_steps:
 *                 xi = np.multiply(xi, self.Omega)
 */
    __pyx_t_13 = (__pyx_v_i + 1);
    __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_13 * __pyx_v_time_points.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_tf, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":3248
 *             ti = time_points[i]
 *             tf = time_points[i+1]
 *             if inter_steps:             # <<<<<<<<<<<<<<
 *                 xi = np.multiply(xi, self.Omega)
 *                 _xm = pyross.utils.forward_euler_integration(self._rhs0, xi,
 */
    __pyx_t_14 = (__pyx_v_inter_steps != 0);
    if (__pyx_t_14) {

      /* "pyross/inference.pyx":3249
 *             tf = time_points[i+1]
 *             if inter_steps:
 *                 xi = np.multiply(xi, self.Omega)             # <<<<<<<<<<<<<<
 *                 _xm = pyross.utils.forward_euler_integration(self._rhs0, xi,
 *                                                              ti, tf,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_multiply); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_xi, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_5);
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 3249, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_xi, 1);
      __pyx_v_xi = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

      /* "pyross/inference.pyx":3250
 *             if inter_steps:
 *                 xi = np.multiply(xi, self.Omega)
 *                 _xm = pyross.utils.forward_euler_integration(self._rhs0, xi,             # <<<<<<<<<<<<<<
 *                                                              ti, tf,
 *                                                              steps, inter_steps)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyross); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_forward_euler_integration); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rhs0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_xi, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "pyross/inference.pyx":3252
 *                 _xm = pyross.utils.forward_euler_integration(self._rhs0, xi,
 *                                                              ti, tf,
 *                                                              steps, inter_steps)             # <<<<<<<<<<<<<<
 *                 _xm = np.divide(_xm, self.Omega)
 *                 self._xm = np.copy(_xm)
 */
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_inter_steps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_t_6, __pyx_t_5, __pyx_v_ti, __pyx_v_tf, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3250, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_t_6, __pyx_t_5, __pyx_v_ti, __pyx_v_tf, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3250, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_16 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3250, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        if (__pyx_t_15) {
          __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_t_5);
        __Pyx_INCREF(__pyx_v_ti);
        __Pyx_GIVEREF(__pyx_v_ti);
        PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_7, __pyx_v_ti);
        __Pyx_INCREF(__pyx_v_tf);
        __Pyx_GIVEREF(__pyx_v_tf);
        PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_7, __pyx_v_tf);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_7, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_7, __pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3250, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pyross/inference.pyx":3250
 *             if inter_steps:
 *                 xi = np.multiply(xi, self.Omega)
 *                 _xm = pyross.utils.forward_euler_integration(self._rhs0, xi,             # <<<<<<<<<<<<<<
 *                                                              ti, tf,
 *                                                              steps, inter_steps)
 */
      __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v__xm, 1);
      __pyx_v__xm = __pyx_t_17;
      __pyx_t_17.memview = NULL;
      __pyx_t_17.data = NULL;

      /* "pyross/inference.pyx":3253
 *                                                              ti, tf,
 *                                                              steps, inter_steps)
 *                 _xm = np.divide(_xm, self.Omega)             # <<<<<<<<<<<<<<
 *                 self._xm = np.copy(_xm)
 *                 self._interp = []
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_divide); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v__xm, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3253, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3253, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_3);
        __pyx_t_8 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 3253, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v__xm, 1);
      __pyx_v__xm = __pyx_t_17;
      __pyx_t_17.memview = NULL;
      __pyx_t_17.data = NULL;

      /* "pyross/inference.pyx":3254
 *                                                              steps, inter_steps)
 *                 _xm = np.divide(_xm, self.Omega)
 *                 self._xm = np.copy(_xm)             # <<<<<<<<<<<<<<
 *                 self._interp = []
 *                 times = np.linspace(ti, tf, inter_steps*steps)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v__xm, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_16);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3254, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->_xm);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_xm));
      __pyx_v_self->_xm = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "pyross/inference.pyx":3255
 *                 _xm = np.divide(_xm, self.Omega)
 *                 self._xm = np.copy(_xm)
 *                 self._interp = []             # <<<<<<<<<<<<<<
 *                 times = np.linspace(ti, tf, inter_steps*steps)
 *                 for i in range(_xm.shape[1]):
 */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->_interp);
      __Pyx_DECREF(__pyx_v_self->_interp);
      __pyx_v_self->_interp = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "pyross/inference.pyx":3256
 *                 self._xm = np.copy(_xm)
 *                 self._interp = []
 *                 times = np.linspace(ti, tf, inter_steps*steps)             # <<<<<<<<<<<<<<
 *                 for i in range(_xm.shape[1]):
 *                     self._interp.append(interpolate.interp1d(times, _xm[:,i],
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3256, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_linspace); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3256, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_inter_steps * __pyx_v_steps)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3256, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_ti, __pyx_v_tf, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3256, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_ti, __pyx_v_tf, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3256, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_ti);
        __Pyx_GIVEREF(__pyx_v_ti);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_ti);
        __Pyx_INCREF(__pyx_v_tf);
        __Pyx_GIVEREF(__pyx_v_tf);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_tf);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF_SET(__pyx_v_times, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pyross/inference.pyx":3257
 *                 self._interp = []
 *                 times = np.linspace(ti, tf, inter_steps*steps)
 *                 for i in range(_xm.shape[1]):             # <<<<<<<<<<<<<<
 *                     self._interp.append(interpolate.interp1d(times, _xm[:,i],
 *                                                              kind='linear'))
 */
      __pyx_t_18 = (__pyx_v__xm.shape[1]);
      __pyx_t_19 = __pyx_t_18;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_i = __pyx_t_20;

        /* "pyross/inference.pyx":3258
 *                 times = np.linspace(ti, tf, inter_steps*steps)
 *                 for i in range(_xm.shape[1]):
 *                     self._interp.append(interpolate.interp1d(times, _xm[:,i],             # <<<<<<<<<<<<<<
 *                                                              kind='linear'))
 *                 xm = _xm[::inter_steps]
 */
        if (unlikely(__pyx_v_self->_interp == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(0, 3258, __pyx_L1_error)
        }
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_interpolate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_interp1d); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9.data = __pyx_v__xm.data;
        __pyx_t_9.memview = __pyx_v__xm.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
        __pyx_t_9.shape[0] = __pyx_v__xm.shape[0];
__pyx_t_9.strides[0] = __pyx_v__xm.strides[0];
    __pyx_t_9.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v__xm.strides[1];
        if ((0)) __PYX_ERR(0, 3258, __pyx_L1_error)
        __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_9, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
        __pyx_t_9.memview = NULL;
        __pyx_t_9.data = NULL;
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_times);
        __Pyx_GIVEREF(__pyx_v_times);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_times);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "pyross/inference.pyx":3259
 *                 for i in range(_xm.shape[1]):
 *                     self._interp.append(interpolate.interp1d(times, _xm[:,i],
 *                                                              kind='linear'))             # <<<<<<<<<<<<<<
 *                 xm = _xm[::inter_steps]
 *                 sol = self.interpolate_euler
 */
        __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3259, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_kind, __pyx_n_u_linear) < 0) __PYX_ERR(0, 3259, __pyx_L1_error)

        /* "pyross/inference.pyx":3258
 *                 times = np.linspace(ti, tf, inter_steps*steps)
 *                 for i in range(_xm.shape[1]):
 *                     self._interp.append(interpolate.interp1d(times, _xm[:,i],             # <<<<<<<<<<<<<<
 *                                                              kind='linear'))
 *                 xm = _xm[::inter_steps]
 */
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_21 = __Pyx_PyList_Append(__pyx_v_self->_interp, __pyx_t_5); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 3258, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }

      /* "pyross/inference.pyx":3260
 *                     self._interp.append(interpolate.interp1d(times, _xm[:,i],
 *                                                              kind='linear'))
 *                 xm = _xm[::inter_steps]             # <<<<<<<<<<<<<<
 *                 sol = self.interpolate_euler
 *             else:
 */
      __pyx_t_17.data = __pyx_v__xm.data;
      __pyx_t_17.memview = __pyx_v__xm.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
      __pyx_t_7 = -1;
      if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_17,
    __pyx_v__xm.shape[0], __pyx_v__xm.strides[0], __pyx_v__xm.suboffsets[0],
    0,
    0,
    &__pyx_t_7,
    0,
    0,
    __pyx_v_inter_steps,
    0,
    0,
    1,
    1) < 0))
{
    __PYX_ERR(0, 3260, __pyx_L1_error)
}

__pyx_t_17.shape[1] = __pyx_v__xm.shape[1];
__pyx_t_17.strides[1] = __pyx_v__xm.strides[1];
    __pyx_t_17.suboffsets[1] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
      __pyx_v_xm = __pyx_t_17;
      __pyx_t_17.memview = NULL;
      __pyx_t_17.data = NULL;

      /* "pyross/inference.pyx":3261
 *                                                              kind='linear'))
 *                 xm = _xm[::inter_steps]
 *                 sol = self.interpolate_euler             # <<<<<<<<<<<<<<
 *             else:
 *                 xm, sol = self.integrate(xi, ti, tf, steps, dense_output=True)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_interpolate_euler); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3261, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_sol, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pyross/inference.pyx":3248
 *             ti = time_points[i]
 *             tf = time_points[i+1]
 *             if inter_steps:             # <<<<<<<<<<<<<<
 *                 xi = np.multiply(xi, self.Omega)
 *                 _xm = pyross.utils.forward_euler_integration(self._rhs0, xi,
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":3263
 *                 sol = self.interpolate_euler
 *             else:
 *                 xm, sol = self.integrate(xi, ti, tf, steps, dense_output=True)             # <<<<<<<<<<<<<<
 *             cov = self._estimate_cond_cov(sol, ti, tf)
 *             dev = np.subtract(xf, xm[steps-1])
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_integrate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xi, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
      __Pyx_INCREF(__pyx_v_ti);
      __Pyx_GIVEREF(__pyx_v_ti);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_ti);
      __Pyx_INCREF(__pyx_v_tf);
      __Pyx_GIVEREF(__pyx_v_tf);
      PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_tf);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_8);
      __pyx_t_2 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dense_output, Py_True) < 0) __PYX_ERR(0, 3263, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 3263, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_16 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_16);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3263, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_16 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3263, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3263, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_22 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_22(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_16 = __pyx_t_22(__pyx_t_5); if (unlikely(!__pyx_t_16)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_16);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_5), 2) < 0) __PYX_ERR(0, 3263, __pyx_L1_error)
        __pyx_t_22 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_22 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 3263, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 3263, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
      __pyx_v_xm = __pyx_t_17;
      __pyx_t_17.memview = NULL;
      __pyx_t_17.data = NULL;
      __Pyx_XDECREF_SET(__pyx_v_sol, __pyx_t_16);
      __pyx_t_16 = 0;
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":3264
 *             else:
 *                 xm, sol = self.integrate(xi, ti, tf, steps, dense_output=True)
 *             cov = self._estimate_cond_cov(sol, ti, tf)             # <<<<<<<<<<<<<<
 *             dev = np.subtract(xf, xm[steps-1])
 *             log_p += self._log_cond_p(dev, cov)
 */
    __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_ti); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3264, __pyx_L1_error)
    __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_tf); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3264, __pyx_L1_error)
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_estimate_cond_cov(__pyx_v_self, __pyx_v_sol, __pyx_t_23, __pyx_t_24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 3264, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
    __pyx_v_cov = __pyx_t_17;
    __pyx_t_17.memview = NULL;
    __pyx_t_17.data = NULL;

    /* "pyross/inference.pyx":3265
 *                 xm, sol = self.integrate(xi, ti, tf, steps, dense_output=True)
 *             cov = self._estimate_cond_cov(sol, ti, tf)
 *             dev = np.subtract(xf, xm[steps-1])             # <<<<<<<<<<<<<<
 *             log_p += self._log_cond_p(dev, cov)
 *         return -log_p
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_subtract); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_xf, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_9.data = __pyx_v_xm.data;
    __pyx_t_9.memview = __pyx_v_xm.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
    {
    Py_ssize_t __pyx_tmp_idx = (__pyx_v_steps - 1);
    Py_ssize_t __pyx_tmp_stride = __pyx_v_xm.strides[0];
        if ((0)) __PYX_ERR(0, 3265, __pyx_L1_error)
        __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_9.shape[0] = __pyx_v_xm.shape[1];
__pyx_t_9.strides[0] = __pyx_v_xm.strides[1];
    __pyx_t_9.suboffsets[0] = -1;

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_9, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;
    __pyx_t_3 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_16, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3265, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_16, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3265, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_5);
      __pyx_t_16 = 0;
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 3265, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_dev, 1);
    __pyx_v_dev = __pyx_t_9;
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;

    /* "pyross/inference.pyx":3266
 *             cov = self._estimate_cond_cov(sol, ti, tf)
 *             dev = np.subtract(xf, xm[steps-1])
 *             log_p += self._log_cond_p(dev, cov)             # <<<<<<<<<<<<<<
 *         return -log_p
 * 
 */
    __pyx_v_log_p = (__pyx_v_log_p + ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_log_cond_p(__pyx_v_self, __pyx_v_dev, __pyx_v_cov));
  }

  /* "pyross/inference.pyx":3267
 *             dev = np.subtract(xf, xm[steps-1])
 *             log_p += self._log_cond_p(dev, cov)
 *         return -log_p             # <<<<<<<<<<<<<<
 * 
 *     cdef double _obtain_logp_for_lat_traj(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,
 */
  __pyx_r = (-__pyx_v_log_p);
  goto __pyx_L0;

  /* "pyross/inference.pyx":3235
 *         return np.add(x0, v)
 * 
 *     cdef double _obtain_logp_for_traj(self, double [:, :] x, double Tf,             # <<<<<<<<<<<<<<
 *                                      Py_ssize_t inter_steps=0):
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
  __Pyx_WriteUnraisable("pyross.inference.SIR_type._obtain_logp_for_traj", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_xi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xf, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dev, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v__xm, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_time_points, 1);
  __Pyx_XDECREF(__pyx_v_ti);
  __Pyx_XDECREF(__pyx_v_tf);
  __Pyx_XDECREF(__pyx_v_times);
  __Pyx_XDECREF(__pyx_v_sol);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3269
 *         return -log_p
 * 
 *     cdef double _obtain_logp_for_lat_traj(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False,
 *                                          Py_ssize_t inter_steps=0):
 */

static double __pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, __Pyx_memviewslice __pyx_v_obs_flattened, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj *__pyx_optional_args) {

  /* "pyross/inference.pyx":3270
 * 
 *     cdef double _obtain_logp_for_lat_traj(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,
 *                                             double Tf, tangent=False,             # <<<<<<<<<<<<<<
 *                                          Py_ssize_t inter_steps=0):
 *         cdef:
 */
  PyObject *__pyx_v_tangent = ((PyObject *)Py_False);
  Py_ssize_t __pyx_v_inter_steps = ((Py_ssize_t)0);
  Py_ssize_t __pyx_v_reduced_dim;
  Py_ssize_t __pyx_v_Nf;
  __Pyx_memviewslice __pyx_v_xm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xm_red = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dev = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_cov_red = 0;
  PyArrayObject *__pyx_v_full_cov = 0;
  PyObject *__pyx_v_full_fltr = NULL;
  PyObject *__pyx_v_cov_red_inv_dev = NULL;
  PyObject *__pyx_v_ldet = NULL;
  PyObject *__pyx_v_log_p = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cov_red;
  __Pyx_Buffer __pyx_pybuffer_cov_red;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_full_cov;
  __Pyx_Buffer __pyx_pybuffer_full_cov;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov __pyx_t_14;
  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  double __pyx_t_18;
  __Pyx_RefNannySetupContext("_obtain_logp_for_lat_traj", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_tangent = __pyx_optional_args->tangent;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_inter_steps = __pyx_optional_args->inter_steps;
      }
    }
  }
  __pyx_pybuffer_cov_red.pybuffer.buf = NULL;
  __pyx_pybuffer_cov_red.refcount = 0;
  __pyx_pybuffernd_cov_red.data = NULL;
  __pyx_pybuffernd_cov_red.rcbuffer = &__pyx_pybuffer_cov_red;
  __pyx_pybuffer_full_cov.pybuffer.buf = NULL;
  __pyx_pybuffer_full_cov.refcount = 0;
  __pyx_pybuffernd_full_cov.data = NULL;
  __pyx_pybuffernd_full_cov.rcbuffer = &__pyx_pybuffer_full_cov;

  /* "pyross/inference.pyx":3273
 *                                          Py_ssize_t inter_steps=0):
 *         cdef:
 *             Py_ssize_t reduced_dim=obs_flattened.shape[0], Nf=fltr.shape[0]+1             # <<<<<<<<<<<<<<
 *             double [:, :] xm
 *             double [:] xm_red, dev
 */
  __pyx_v_reduced_dim = (__pyx_v_obs_flattened.shape[0]);
  __pyx_v_Nf = ((__pyx_v_fltr->dimensions[0]) + 1);

  /* "pyross/inference.pyx":3277
 *             double [:] xm_red, dev
 *             np.ndarray[DTYPE_t, ndim=2] cov_red, full_cov
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3277, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":3278
 *             np.ndarray[DTYPE_t, ndim=2] cov_red, full_cov
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.inter_steps = __pyx_v_inter_steps;
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov_tangent_space(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3278, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 3278, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3278, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3278, __pyx_L1_error)
    __pyx_v_xm = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer, (PyObject*)__pyx_v_full_cov, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_full_cov.diminfo[0].strides = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_full_cov.diminfo[0].shape = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_full_cov.diminfo[1].strides = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_full_cov.diminfo[1].shape = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3278, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_full_cov = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3277
 *             double [:] xm_red, dev
 *             np.ndarray[DTYPE_t, ndim=2] cov_red, full_cov
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3280
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         full_fltr = sparse.block_diag(fltr)
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)
 */
  /*else*/ {
    __pyx_t_14.__pyx_n = 1;
    __pyx_t_14.inter_steps = __pyx_v_inter_steps;
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 0, &__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3280, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 3280, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3280, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3280, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3280, __pyx_L1_error)
    __pyx_v_xm = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer, (PyObject*)__pyx_v_full_cov, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_full_cov.diminfo[0].strides = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_full_cov.diminfo[0].shape = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_full_cov.diminfo[1].strides = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_full_cov.diminfo[1].shape = __pyx_pybuffernd_full_cov.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3280, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_full_cov = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3281
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 *         full_fltr = sparse.block_diag(fltr)             # <<<<<<<<<<<<<<
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)
 *         xm_red = full_fltr@(np.ravel(xm))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sparse); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, ((PyObject *)__pyx_v_fltr)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_fltr));
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_full_fltr = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3282
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 *         full_fltr = sparse.block_diag(fltr)
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)             # <<<<<<<<<<<<<<
 *         xm_red = full_fltr@(np.ravel(xm))
 *         dev=np.subtract(obs_flattened, xm_red)
 */
  __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, ((PyObject *)__pyx_v_full_cov)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_transpose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_full_fltr) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3282, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cov_red.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cov_red.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cov_red.rcbuffer->pybuffer, (PyObject*)__pyx_v_cov_red, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_cov_red.diminfo[0].strides = __pyx_pybuffernd_cov_red.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cov_red.diminfo[0].shape = __pyx_pybuffernd_cov_red.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_cov_red.diminfo[1].strides = __pyx_pybuffernd_cov_red.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_cov_red.diminfo[1].shape = __pyx_pybuffernd_cov_red.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3282, __pyx_L1_error)
  }
  __pyx_t_9 = 0;
  __pyx_v_cov_red = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":3283
 *         full_fltr = sparse.block_diag(fltr)
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)
 *         xm_red = full_fltr@(np.ravel(xm))             # <<<<<<<<<<<<<<
 *         dev=np.subtract(obs_flattened, xm_red)
 *         cov_red_inv_dev, ldet = pyross.utils.solve_symmetric_close_to_singular(cov_red, dev)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ravel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_xm, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 3283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_xm_red = __pyx_t_15;
  __pyx_t_15.memview = NULL;
  __pyx_t_15.data = NULL;

  /* "pyross/inference.pyx":3284
 *         cov_red = full_fltr@full_cov@np.transpose(full_fltr)
 *         xm_red = full_fltr@(np.ravel(xm))
 *         dev=np.subtract(obs_flattened, xm_red)             # <<<<<<<<<<<<<<
 *         cov_red_inv_dev, ldet = pyross.utils.solve_symmetric_close_to_singular(cov_red, dev)
 *         log_p = -np.dot(dev, cov_red_inv_dev)*(self.Omega/2)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_subtract); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_obs_flattened, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_xm_red, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_6, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3284, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_6, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3284, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_17 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    if (__pyx_t_16) {
      __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_10, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_10, __pyx_t_4);
    __pyx_t_6 = 0;
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 3284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dev = __pyx_t_15;
  __pyx_t_15.memview = NULL;
  __pyx_t_15.data = NULL;

  /* "pyross/inference.pyx":3285
 *         xm_red = full_fltr@(np.ravel(xm))
 *         dev=np.subtract(obs_flattened, xm_red)
 *         cov_red_inv_dev, ldet = pyross.utils.solve_symmetric_close_to_singular(cov_red, dev)             # <<<<<<<<<<<<<<
 *         log_p = -np.dot(dev, cov_red_inv_dev)*(self.Omega/2)
 *         log_p -= (ldet-reduced_dim*log(self.Omega))/2 + (reduced_dim/2)*log(2*PI)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_solve_symmetric_close_to_singula); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_dev, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_4 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_cov_red), __pyx_t_17};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_cov_red), __pyx_t_17};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_cov_red));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_cov_red));
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, ((PyObject *)__pyx_v_cov_red));
    __Pyx_GIVEREF(__pyx_t_17);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_t_17);
    __pyx_t_17 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3285, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_17 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_17)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_17); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_17); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_17), 2) < 0) __PYX_ERR(0, 3285, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3285, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_cov_red_inv_dev = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_ldet = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":3286
 *         dev=np.subtract(obs_flattened, xm_red)
 *         cov_red_inv_dev, ldet = pyross.utils.solve_symmetric_close_to_singular(cov_red, dev)
 *         log_p = -np.dot(dev, cov_red_inv_dev)*(self.Omega/2)             # <<<<<<<<<<<<<<
 *         log_p -= (ldet-reduced_dim*log(self.Omega))/2 + (reduced_dim/2)*log(2*PI)
 *         log_p -= reduced_dim*np.log(self.Omega)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dev, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_17 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_6, __pyx_v_cov_red_inv_dev};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_6, __pyx_v_cov_red_inv_dev};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_17) {
      __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_17); __pyx_t_17 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_10, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_cov_red_inv_dev);
    __Pyx_GIVEREF(__pyx_v_cov_red_inv_dev);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_10, __pyx_v_cov_red_inv_dev);
    __pyx_t_6 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->Omega / 2.0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_log_p = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3287
 *         cov_red_inv_dev, ldet = pyross.utils.solve_symmetric_close_to_singular(cov_red, dev)
 *         log_p = -np.dot(dev, cov_red_inv_dev)*(self.Omega/2)
 *         log_p -= (ldet-reduced_dim*log(self.Omega))/2 + (reduced_dim/2)*log(2*PI)             # <<<<<<<<<<<<<<
 *         log_p -= reduced_dim*np.log(self.Omega)
 *         return -log_p
 */
  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_reduced_dim * log(__pyx_v_self->Omega))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_ldet, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_reduced_dim / 2) * log((2.0 * __pyx_v_6pyross_9inference_PI)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_log_p, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_log_p, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3288
 *         log_p = -np.dot(dev, cov_red_inv_dev)*(self.Omega/2)
 *         log_p -= (ldet-reduced_dim*log(self.Omega))/2 + (reduced_dim/2)*log(2*PI)
 *         log_p -= reduced_dim*np.log(self.Omega)             # <<<<<<<<<<<<<<
 *         return -log_p
 * 
 */
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_reduced_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_17 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_17, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_v_log_p, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_log_p, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3289
 *         log_p -= (ldet-reduced_dim*log(self.Omega))/2 + (reduced_dim/2)*log(2*PI)
 *         log_p -= reduced_dim*np.log(self.Omega)
 *         return -log_p             # <<<<<<<<<<<<<<
 * 
 *     def _mean_cov_for_lat_endpoint(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,
 */
  __pyx_t_5 = PyNumber_Negative(__pyx_v_log_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_18;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3269
 *         return -log_p
 * 
 *     cdef double _obtain_logp_for_lat_traj(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False,
 *                                          Py_ssize_t inter_steps=0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cov_red.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_WriteUnraisable("pyross.inference.SIR_type._obtain_logp_for_lat_traj", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cov_red.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_full_cov.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xm_red, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dev, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_cov_red);
  __Pyx_XDECREF((PyObject *)__pyx_v_full_cov);
  __Pyx_XDECREF(__pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_v_cov_red_inv_dev);
  __Pyx_XDECREF(__pyx_v_ldet);
  __Pyx_XDECREF(__pyx_v_log_p);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3291
 *         return -log_p
 * 
 *     def _mean_cov_for_lat_endpoint(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_125_mean_cov_for_lat_endpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_125_mean_cov_for_lat_endpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_x0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_obs_flattened = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_fltr = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_tangent = 0;
  Py_ssize_t __pyx_v_inter_steps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_mean_cov_for_lat_endpoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x0,&__pyx_n_s_obs_flattened,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_tangent,&__pyx_n_s_inter_steps,0};
    PyObject* values[6] = {0,0,0,0,0,0};

    /* "pyross/inference.pyx":3292
 * 
 *     def _mean_cov_for_lat_endpoint(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, reduced_dim=obs_flattened.shape[0]
 */
    values[4] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs_flattened)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_endpoint", 0, 4, 6, 1); __PYX_ERR(0, 3291, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_endpoint", 0, 4, 6, 2); __PYX_ERR(0, 3291, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_endpoint", 0, 4, 6, 3); __PYX_ERR(0, 3291, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mean_cov_for_lat_endpoint") < 0)) __PYX_ERR(0, 3291, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x0 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x0.memview)) __PYX_ERR(0, 3291, __pyx_L3_error)
    __pyx_v_obs_flattened = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_obs_flattened.memview)) __PYX_ERR(0, 3291, __pyx_L3_error)
    __pyx_v_fltr = ((PyArrayObject *)values[2]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3292, __pyx_L3_error)
    __pyx_v_tangent = values[4];
    if (values[5]) {
      __pyx_v_inter_steps = __Pyx_PyIndex_AsSsize_t(values[5]); if (unlikely((__pyx_v_inter_steps == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3292, __pyx_L3_error)
    } else {
      __pyx_v_inter_steps = ((Py_ssize_t)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_endpoint", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3291, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._mean_cov_for_lat_endpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 3291, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_124_mean_cov_for_lat_endpoint(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0, __pyx_v_obs_flattened, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_tangent, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":3291
 *         return -log_p
 * 
 *     def _mean_cov_for_lat_endpoint(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_124_mean_cov_for_lat_endpoint(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, __Pyx_memviewslice __pyx_v_obs_flattened, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_tangent, Py_ssize_t __pyx_v_inter_steps) {
  Py_ssize_t __pyx_v_Nf;
  Py_ssize_t __pyx_v_reduced_dim;
  PyObject *__pyx_v_xm = NULL;
  PyObject *__pyx_v_full_cov = NULL;
  PyObject *__pyx_v_last_fltr = NULL;
  PyObject *__pyx_v_last_obs = NULL;
  PyObject *__pyx_v_null_space = NULL;
  PyObject *__pyx_v_known_space = NULL;
  PyObject *__pyx_v_last_full_fltr = NULL;
  PyObject *__pyx_v_full_fltr = NULL;
  PyObject *__pyx_v_cov_red = NULL;
  PyObject *__pyx_v_xm_red = NULL;
  PyObject *__pyx_v_xm_known = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_v_invcov = NULL;
  PyObject *__pyx_v_cov_last_red = NULL;
  PyObject *__pyx_v_xm_last_red = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("_mean_cov_for_lat_endpoint", 0);

  /* "pyross/inference.pyx":3294
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, reduced_dim=obs_flattened.shape[0]             # <<<<<<<<<<<<<<
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 */
  __pyx_v_Nf = ((__pyx_v_fltr->dimensions[0]) + 1);
  __pyx_v_reduced_dim = (__pyx_v_obs_flattened.shape[0]);

  /* "pyross/inference.pyx":3295
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, reduced_dim=obs_flattened.shape[0]
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3295, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":3296
 *             Py_ssize_t Nf=fltr.shape[0]+1, reduced_dim=obs_flattened.shape[0]
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.inter_steps = __pyx_v_inter_steps;
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov_tangent_space(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3296, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 3296, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3296, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_full_cov = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3295
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, reduced_dim=obs_flattened.shape[0]
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3298
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         last_fltr = fltr[Nf-2]
 *         last_obs = obs_flattened[reduced_dim-last_fltr.shape[0]:]
 */
  /*else*/ {
    __pyx_t_8.__pyx_n = 1;
    __pyx_t_8.inter_steps = __pyx_v_inter_steps;
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 0, &__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3298, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 3298, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3298, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_full_cov = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3299
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 *         last_fltr = fltr[Nf-2]             # <<<<<<<<<<<<<<
 *         last_obs = obs_flattened[reduced_dim-last_fltr.shape[0]:]
 *         null_space, known_space = self._split_spaces(last_fltr, last_obs)
 */
  __pyx_t_9 = (__pyx_v_Nf - 2);
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_fltr), __pyx_t_9, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_last_fltr = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3300
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 *         last_fltr = fltr[Nf-2]
 *         last_obs = obs_flattened[reduced_dim-last_fltr.shape[0]:]             # <<<<<<<<<<<<<<
 *         null_space, known_space = self._split_spaces(last_fltr, last_obs)
 * 
 */
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_reduced_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_last_fltr, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3300, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10.data = __pyx_v_obs_flattened.data;
  __pyx_t_10.memview = __pyx_v_obs_flattened.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
  __pyx_t_11 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_10,
    __pyx_v_obs_flattened.shape[0], __pyx_v_obs_flattened.strides[0], __pyx_v_obs_flattened.suboffsets[0],
    0,
    0,
    &__pyx_t_11,
    __pyx_t_9,
    0,
    0,
    1,
    0,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3300, __pyx_L1_error)
}

__pyx_t_4 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_v_last_obs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3301
 *         last_fltr = fltr[Nf-2]
 *         last_obs = obs_flattened[reduced_dim-last_fltr.shape[0]:]
 *         null_space, known_space = self._split_spaces(last_fltr, last_obs)             # <<<<<<<<<<<<<<
 * 
 *         last_full_fltr = np.vstack((fltr[Nf-2], null_space))
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_split_spaces); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_last_fltr, __pyx_v_last_obs};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_last_fltr, __pyx_v_last_obs};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_last_fltr);
    __Pyx_GIVEREF(__pyx_v_last_fltr);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_11, __pyx_v_last_fltr);
    __Pyx_INCREF(__pyx_v_last_obs);
    __Pyx_GIVEREF(__pyx_v_last_obs);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_11, __pyx_v_last_obs);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3301, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_2), 2) < 0) __PYX_ERR(0, 3301, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3301, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_null_space = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_known_space = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pyross/inference.pyx":3303
 *         null_space, known_space = self._split_spaces(last_fltr, last_obs)
 * 
 *         last_full_fltr = np.vstack((fltr[Nf-2], null_space))             # <<<<<<<<<<<<<<
 *         full_fltr = sparse.block_diag([*fltr[:Nf-2], last_full_fltr])
 *         cov_red = full_fltr@full_cov@(full_fltr.T)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_vstack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_9 = (__pyx_v_Nf - 2);
  __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_fltr), __pyx_t_9, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_null_space);
  __Pyx_GIVEREF(__pyx_v_null_space);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_null_space);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_last_full_fltr = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3304
 * 
 *         last_full_fltr = np.vstack((fltr[Nf-2], null_space))
 *         full_fltr = sparse.block_diag([*fltr[:Nf-2], last_full_fltr])             # <<<<<<<<<<<<<<
 *         cov_red = full_fltr@full_cov@(full_fltr.T)
 *         xm_red = full_fltr@np.ravel(xm)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sparse); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_fltr), 0, (__pyx_v_Nf - 2), NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PySequence_List(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_ListComp_Append(__pyx_t_5, __pyx_v_last_full_fltr) < 0) __PYX_ERR(0, 3304, __pyx_L1_error)
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_full_fltr = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3305
 *         last_full_fltr = np.vstack((fltr[Nf-2], null_space))
 *         full_fltr = sparse.block_diag([*fltr[:Nf-2], last_full_fltr])
 *         cov_red = full_fltr@full_cov@(full_fltr.T)             # <<<<<<<<<<<<<<
 *         xm_red = full_fltr@np.ravel(xm)
 * 
 */
  __pyx_t_4 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, __pyx_v_full_cov); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_full_fltr, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cov_red = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3306
 *         full_fltr = sparse.block_diag([*fltr[:Nf-2], last_full_fltr])
 *         cov_red = full_fltr@full_cov@(full_fltr.T)
 *         xm_red = full_fltr@np.ravel(xm)             # <<<<<<<<<<<<<<
 * 
 *         xm_known = xm_red[:reduced_dim]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ravel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_xm) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_xm);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_xm_red = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3308
 *         xm_red = full_fltr@np.ravel(xm)
 * 
 *         xm_known = xm_red[:reduced_dim]             # <<<<<<<<<<<<<<
 *         dev=np.subtract(obs_flattened, xm_known)
 *         invcov = np.linalg.inv(cov_red)
 */
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_xm_red, 0, __pyx_v_reduced_dim, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_xm_known = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3309
 * 
 *         xm_known = xm_red[:reduced_dim]
 *         dev=np.subtract(obs_flattened, xm_known)             # <<<<<<<<<<<<<<
 *         invcov = np.linalg.inv(cov_red)
 *         cov_last_red = np.linalg.inv(invcov[reduced_dim:, reduced_dim:])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_subtract); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_obs_flattened, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_xm_known};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3309, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_xm_known};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3309, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_xm_known);
    __Pyx_GIVEREF(__pyx_v_xm_known);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_xm_known);
    __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dev = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3310
 *         xm_known = xm_red[:reduced_dim]
 *         dev=np.subtract(obs_flattened, xm_known)
 *         invcov = np.linalg.inv(cov_red)             # <<<<<<<<<<<<<<
 *         cov_last_red = np.linalg.inv(invcov[reduced_dim:, reduced_dim:])
 *         xm_last_red = xm_red[reduced_dim:] - cov_last_red@invcov[reduced_dim:, :reduced_dim]@dev
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_inv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_v_cov_red) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_cov_red);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_invcov = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3311
 *         dev=np.subtract(obs_flattened, xm_known)
 *         invcov = np.linalg.inv(cov_red)
 *         cov_last_red = np.linalg.inv(invcov[reduced_dim:, reduced_dim:])             # <<<<<<<<<<<<<<
 *         xm_last_red = xm_red[reduced_dim:] - cov_last_red@invcov[reduced_dim:, :reduced_dim]@dev
 *         return xm_last_red, cov_last_red/self.Omega, null_space, known_space
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_inv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_reduced_dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_5 = PySlice_New(__pyx_t_12, Py_None, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_reduced_dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_6 = PySlice_New(__pyx_t_12, Py_None, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_invcov, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cov_last_red = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3312
 *         invcov = np.linalg.inv(cov_red)
 *         cov_last_red = np.linalg.inv(invcov[reduced_dim:, reduced_dim:])
 *         xm_last_red = xm_red[reduced_dim:] - cov_last_red@invcov[reduced_dim:, :reduced_dim]@dev             # <<<<<<<<<<<<<<
 *         return xm_last_red, cov_last_red/self.Omega, null_space, known_space
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_xm_red, __pyx_v_reduced_dim, 0, NULL, NULL, NULL, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_reduced_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PySlice_New(__pyx_t_2, Py_None, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_reduced_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = PySlice_New(Py_None, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12);
  __pyx_t_6 = 0;
  __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_v_invcov, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_cov_last_red, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_2, __pyx_v_dev); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_xm_last_red = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3313
 *         cov_last_red = np.linalg.inv(invcov[reduced_dim:, reduced_dim:])
 *         xm_last_red = xm_red[reduced_dim:] - cov_last_red@invcov[reduced_dim:, :reduced_dim]@dev
 *         return xm_last_red, cov_last_red/self.Omega, null_space, known_space             # <<<<<<<<<<<<<<
 * 
 *     def _mean_cov_for_lat_traj(self, double [:] x0, np.ndarray obs, np.ndarray fltr,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_v_cov_last_red, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_xm_last_red);
  __Pyx_GIVEREF(__pyx_v_xm_last_red);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xm_last_red);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12);
  __Pyx_INCREF(__pyx_v_null_space);
  __Pyx_GIVEREF(__pyx_v_null_space);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_null_space);
  __Pyx_INCREF(__pyx_v_known_space);
  __Pyx_GIVEREF(__pyx_v_known_space);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_known_space);
  __pyx_t_12 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3291
 *         return -log_p
 * 
 *     def _mean_cov_for_lat_endpoint(self, double [:] x0, double [:] obs_flattened, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SIR_type._mean_cov_for_lat_endpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xm);
  __Pyx_XDECREF(__pyx_v_full_cov);
  __Pyx_XDECREF(__pyx_v_last_fltr);
  __Pyx_XDECREF(__pyx_v_last_obs);
  __Pyx_XDECREF(__pyx_v_null_space);
  __Pyx_XDECREF(__pyx_v_known_space);
  __Pyx_XDECREF(__pyx_v_last_full_fltr);
  __Pyx_XDECREF(__pyx_v_full_fltr);
  __Pyx_XDECREF(__pyx_v_cov_red);
  __Pyx_XDECREF(__pyx_v_xm_red);
  __Pyx_XDECREF(__pyx_v_xm_known);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XDECREF(__pyx_v_invcov);
  __Pyx_XDECREF(__pyx_v_cov_last_red);
  __Pyx_XDECREF(__pyx_v_xm_last_red);
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_obs_flattened, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3315
 *         return xm_last_red, cov_last_red/self.Omega, null_space, known_space
 * 
 *     def _mean_cov_for_lat_traj(self, double [:] x0, np.ndarray obs, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_127_mean_cov_for_lat_traj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_127_mean_cov_for_lat_traj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_x0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_fltr = 0;
  double __pyx_v_Tf;
  PyObject *__pyx_v_tangent = 0;
  Py_ssize_t __pyx_v_inter_steps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_mean_cov_for_lat_traj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x0,&__pyx_n_s_obs,&__pyx_n_s_fltr,&__pyx_n_s_Tf,&__pyx_n_s_tangent,&__pyx_n_s_inter_steps,0};
    PyObject* values[6] = {0,0,0,0,0,0};

    /* "pyross/inference.pyx":3316
 * 
 *     def _mean_cov_for_lat_traj(self, double [:] x0, np.ndarray obs, np.ndarray fltr,
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, i, dim=self.dim
 */
    values[4] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_traj", 0, 4, 6, 1); __PYX_ERR(0, 3315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_traj", 0, 4, 6, 2); __PYX_ERR(0, 3315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_traj", 0, 4, 6, 3); __PYX_ERR(0, 3315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tangent);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mean_cov_for_lat_traj") < 0)) __PYX_ERR(0, 3315, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x0 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x0.memview)) __PYX_ERR(0, 3315, __pyx_L3_error)
    __pyx_v_obs = ((PyArrayObject *)values[1]);
    __pyx_v_fltr = ((PyArrayObject *)values[2]);
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3316, __pyx_L3_error)
    __pyx_v_tangent = values[4];
    if (values[5]) {
      __pyx_v_inter_steps = __Pyx_PyIndex_AsSsize_t(values[5]); if (unlikely((__pyx_v_inter_steps == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3316, __pyx_L3_error)
    } else {
      __pyx_v_inter_steps = ((Py_ssize_t)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_mean_cov_for_lat_traj", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3315, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._mean_cov_for_lat_traj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obs), __pyx_ptype_5numpy_ndarray, 1, "obs", 0))) __PYX_ERR(0, 3315, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fltr), __pyx_ptype_5numpy_ndarray, 1, "fltr", 0))) __PYX_ERR(0, 3315, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_126_mean_cov_for_lat_traj(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0, __pyx_v_obs, __pyx_v_fltr, __pyx_v_Tf, __pyx_v_tangent, __pyx_v_inter_steps);

  /* "pyross/inference.pyx":3315
 *         return xm_last_red, cov_last_red/self.Omega, null_space, known_space
 * 
 *     def _mean_cov_for_lat_traj(self, double [:] x0, np.ndarray obs, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_126_mean_cov_for_lat_traj(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, PyArrayObject *__pyx_v_obs, PyArrayObject *__pyx_v_fltr, double __pyx_v_Tf, PyObject *__pyx_v_tangent, Py_ssize_t __pyx_v_inter_steps) {
  Py_ssize_t __pyx_v_Nf;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_dim;
  PyObject *__pyx_v_xm = NULL;
  PyObject *__pyx_v_full_cov = NULL;
  PyObject *__pyx_v_known_spaces = NULL;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v_null_spaces = NULL;
  PyObject *__pyx_v_full_fltrs = NULL;
  PyObject *__pyx_v_null_space = NULL;
  PyObject *__pyx_v_full_fltr_mat = NULL;
  PyObject *__pyx_v_full_null_space = NULL;
  PyObject *__pyx_v_xm_known = NULL;
  PyObject *__pyx_v_obs_flattened = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_v_invcov = NULL;
  PyObject *__pyx_v_cov_red = NULL;
  PyObject *__pyx_v_xm_red = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __Pyx_RefNannySetupContext("_mean_cov_for_lat_traj", 0);

  /* "pyross/inference.pyx":3318
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, i, dim=self.dim             # <<<<<<<<<<<<<<
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 */
  __pyx_v_Nf = ((__pyx_v_fltr->dimensions[0]) + 1);
  __pyx_t_1 = __pyx_v_self->dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":3319
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, i, dim=self.dim
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_tangent); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3319, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":3320
 *             Py_ssize_t Nf=fltr.shape[0]+1, i, dim=self.dim
 *         if tangent:
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 */
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.inter_steps = __pyx_v_inter_steps;
    __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov_tangent_space(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3320, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 3320, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3320, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_full_cov = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":3319
 *         cdef:
 *             Py_ssize_t Nf=fltr.shape[0]+1, i, dim=self.dim
 *         if tangent:             # <<<<<<<<<<<<<<
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3322
 *             xm, full_cov = self.obtain_full_mean_cov_tangent_space(x0, Tf, Nf, inter_steps=inter_steps)
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)             # <<<<<<<<<<<<<<
 *         known_spaces = np.empty((Nf-1, dim), dtype=DTYPE)
 *         mask = np.zeros((Nf-1)*dim, dtype='bool')
 */
  /*else*/ {
    __pyx_t_9.__pyx_n = 1;
    __pyx_t_9.inter_steps = __pyx_v_inter_steps;
    __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->obtain_full_mean_cov(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 0, &__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3322, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 3322, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3322, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_xm = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_full_cov = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3323
 *         else:
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 *         known_spaces = np.empty((Nf-1, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         mask = np.zeros((Nf-1)*dim, dtype='bool')
 *         null_spaces = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_known_spaces = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3324
 *             xm, full_cov = self.obtain_full_mean_cov(x0, Tf, Nf, inter_steps=inter_steps)
 *         known_spaces = np.empty((Nf-1, dim), dtype=DTYPE)
 *         mask = np.zeros((Nf-1)*dim, dtype='bool')             # <<<<<<<<<<<<<<
 *         null_spaces = []
 *         full_fltrs = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(((__pyx_v_Nf - 1) * __pyx_v_dim)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_u_bool) < 0) __PYX_ERR(0, 3324, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_mask = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3325
 *         known_spaces = np.empty((Nf-1, dim), dtype=DTYPE)
 *         mask = np.zeros((Nf-1)*dim, dtype='bool')
 *         null_spaces = []             # <<<<<<<<<<<<<<
 *         full_fltrs = []
 * 
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_null_spaces = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3326
 *         mask = np.zeros((Nf-1)*dim, dtype='bool')
 *         null_spaces = []
 *         full_fltrs = []             # <<<<<<<<<<<<<<
 * 
 *         for i in range(Nf-1):
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_full_fltrs = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3328
 *         full_fltrs = []
 * 
 *         for i in range(Nf-1):             # <<<<<<<<<<<<<<
 *             null_space, known_spaces[i] = self._split_spaces(fltr[i], obs[i])
 *             null_spaces.append(null_space)
 */
  __pyx_t_1 = (__pyx_v_Nf - 1);
  __pyx_t_10 = __pyx_t_1;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pyross/inference.pyx":3329
 * 
 *         for i in range(Nf-1):
 *             null_space, known_spaces[i] = self._split_spaces(fltr[i], obs[i])             # <<<<<<<<<<<<<<
 *             null_spaces.append(null_space)
 *             full_fltrs.append(np.vstack((fltr[i], null_space)))
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_split_spaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_fltr), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_obs), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = NULL;
    __pyx_t_13 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_13 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_6, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_6, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_7);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3329, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_14);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_14 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_14)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 3329, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3329, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_null_space, __pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(__Pyx_SetItemInt(__pyx_v_known_spaces, __pyx_v_i, __pyx_t_14, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "pyross/inference.pyx":3330
 *         for i in range(Nf-1):
 *             null_space, known_spaces[i] = self._split_spaces(fltr[i], obs[i])
 *             null_spaces.append(null_space)             # <<<<<<<<<<<<<<
 *             full_fltrs.append(np.vstack((fltr[i], null_space)))
 *             mask[i*dim:i*dim+len(obs[i])] = True
 */
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_null_spaces, __pyx_v_null_space); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 3330, __pyx_L1_error)

    /* "pyross/inference.pyx":3331
 *             null_space, known_spaces[i] = self._split_spaces(fltr[i], obs[i])
 *             null_spaces.append(null_space)
 *             full_fltrs.append(np.vstack((fltr[i], null_space)))             # <<<<<<<<<<<<<<
 *             mask[i*dim:i*dim+len(obs[i])] = True
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_vstack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_GetItemInt(((PyObject *)__pyx_v_fltr), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_14);
    __Pyx_INCREF(__pyx_v_null_space);
    __Pyx_GIVEREF(__pyx_v_null_space);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_null_space);
    __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_5 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_14, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_full_fltrs, __pyx_t_5); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3332
 *             null_spaces.append(null_space)
 *             full_fltrs.append(np.vstack((fltr[i], null_space)))
 *             mask[i*dim:i*dim+len(obs[i])] = True             # <<<<<<<<<<<<<<
 * 
 *         full_fltr_mat = sparse.block_diag(full_fltrs)
 */
    __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_obs), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3332, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetSlice(__pyx_v_mask, Py_True, (__pyx_v_i * __pyx_v_dim), ((__pyx_v_i * __pyx_v_dim) + __pyx_t_16), NULL, NULL, NULL, 1, 1, 0) < 0) __PYX_ERR(0, 3332, __pyx_L1_error)
  }

  /* "pyross/inference.pyx":3334
 *             mask[i*dim:i*dim+len(obs[i])] = True
 * 
 *         full_fltr_mat = sparse.block_diag(full_fltrs)             # <<<<<<<<<<<<<<
 *         full_null_space = sparse.block_diag(null_spaces)
 *         full_cov = full_fltr_mat@full_cov@(full_fltr_mat.T)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sparse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_v_full_fltrs) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_full_fltrs);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_full_fltr_mat = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3335
 * 
 *         full_fltr_mat = sparse.block_diag(full_fltrs)
 *         full_null_space = sparse.block_diag(null_spaces)             # <<<<<<<<<<<<<<
 *         full_cov = full_fltr_mat@full_cov@(full_fltr_mat.T)
 *         xm  = full_fltr_mat@np.ravel(xm)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_sparse); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_block_diag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_null_spaces) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_null_spaces);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_full_null_space = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3336
 *         full_fltr_mat = sparse.block_diag(full_fltrs)
 *         full_null_space = sparse.block_diag(null_spaces)
 *         full_cov = full_fltr_mat@full_cov@(full_fltr_mat.T)             # <<<<<<<<<<<<<<
 *         xm  = full_fltr_mat@np.ravel(xm)
 * 
 */
  __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr_mat, __pyx_v_full_cov); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_full_fltr_mat, __pyx_n_s_T); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_full_cov, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":3337
 *         full_null_space = sparse.block_diag(null_spaces)
 *         full_cov = full_fltr_mat@full_cov@(full_fltr_mat.T)
 *         xm  = full_fltr_mat@np.ravel(xm)             # <<<<<<<<<<<<<<
 * 
 *         xm_known = xm[mask]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ravel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_7 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_xm) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_xm);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_full_fltr_mat, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_xm, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3339
 *         xm  = full_fltr_mat@np.ravel(xm)
 * 
 *         xm_known = xm[mask]             # <<<<<<<<<<<<<<
 *         obs_flattened = pyross.utils.process_obs(obs, Nf-1)
 *         dev=np.subtract(obs_flattened, xm_known)
 */
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_xm, __pyx_v_mask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_xm_known = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3340
 * 
 *         xm_known = xm[mask]
 *         obs_flattened = pyross.utils.process_obs(obs, Nf-1)             # <<<<<<<<<<<<<<
 *         dev=np.subtract(obs_flattened, xm_known)
 *         invcov = np.linalg.inv(full_cov)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyross); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_obs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_14 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_13 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_14, ((PyObject *)__pyx_v_obs), __pyx_t_3};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3340, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_14, ((PyObject *)__pyx_v_obs), __pyx_t_3};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3340, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_14); __pyx_t_14 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_obs));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_obs));
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_13, ((PyObject *)__pyx_v_obs));
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_13, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_obs_flattened = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3341
 *         xm_known = xm[mask]
 *         obs_flattened = pyross.utils.process_obs(obs, Nf-1)
 *         dev=np.subtract(obs_flattened, xm_known)             # <<<<<<<<<<<<<<
 *         invcov = np.linalg.inv(full_cov)
 *         cov_red = np.linalg.inv(invcov[np.invert(mask)][:, np.invert(mask)])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_subtract); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_13 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_obs_flattened, __pyx_v_xm_known};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3341, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_obs_flattened, __pyx_v_xm_known};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3341, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_obs_flattened);
    __Pyx_GIVEREF(__pyx_v_obs_flattened);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_13, __pyx_v_obs_flattened);
    __Pyx_INCREF(__pyx_v_xm_known);
    __Pyx_GIVEREF(__pyx_v_xm_known);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_13, __pyx_v_xm_known);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_dev = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3342
 *         obs_flattened = pyross.utils.process_obs(obs, Nf-1)
 *         dev=np.subtract(obs_flattened, xm_known)
 *         invcov = np.linalg.inv(full_cov)             # <<<<<<<<<<<<<<
 *         cov_red = np.linalg.inv(invcov[np.invert(mask)][:, np.invert(mask)])
 *         xm_red = xm[np.invert(mask)] - cov_red@invcov[np.invert(mask)][:, mask]@dev
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_linalg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_inv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_v_full_cov) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_full_cov);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_invcov = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3343
 *         dev=np.subtract(obs_flattened, xm_known)
 *         invcov = np.linalg.inv(full_cov)
 *         cov_red = np.linalg.inv(invcov[np.invert(mask)][:, np.invert(mask)])             # <<<<<<<<<<<<<<
 *         xm_red = xm[np.invert(mask)] - cov_red@invcov[np.invert(mask)][:, mask]@dev
 *         return xm_red, cov_red/self.Omega, full_null_space, known_spaces.flatten()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_linalg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_inv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_invert); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_7, __pyx_v_mask) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_mask);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_invcov, __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_invert); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_7, __pyx_v_mask) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_mask);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_slice_);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_cov_red = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3344
 *         invcov = np.linalg.inv(full_cov)
 *         cov_red = np.linalg.inv(invcov[np.invert(mask)][:, np.invert(mask)])
 *         xm_red = xm[np.invert(mask)] - cov_red@invcov[np.invert(mask)][:, mask]@dev             # <<<<<<<<<<<<<<
 *         return xm_red, cov_red/self.Omega, full_null_space, known_spaces.flatten()
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_invert); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_mask) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_mask);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_xm, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_invert); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_6, __pyx_v_mask) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_mask);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_v_invcov, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_slice_);
  __Pyx_INCREF(__pyx_v_mask);
  __Pyx_GIVEREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_mask);
  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_cov_red, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_5, __pyx_v_dev); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_xm_red = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":3345
 *         cov_red = np.linalg.inv(invcov[np.invert(mask)][:, np.invert(mask)])
 *         xm_red = xm[np.invert(mask)] - cov_red@invcov[np.invert(mask)][:, mask]@dev
 *         return xm_red, cov_red/self.Omega, full_null_space, known_spaces.flatten()             # <<<<<<<<<<<<<<
 * 
 *     def _split_spaces(self, fltr, obs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_cov_red, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_known_spaces, __pyx_n_s_flatten); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_5 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_xm_red);
  __Pyx_GIVEREF(__pyx_v_xm_red);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_xm_red);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_full_null_space);
  __Pyx_GIVEREF(__pyx_v_full_null_space);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_full_null_space);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3315
 *         return xm_last_red, cov_last_red/self.Omega, null_space, known_space
 * 
 *     def _mean_cov_for_lat_traj(self, double [:] x0, np.ndarray obs, np.ndarray fltr,             # <<<<<<<<<<<<<<
 *                                             double Tf, tangent=False, Py_ssize_t inter_steps=0):
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyross.inference.SIR_type._mean_cov_for_lat_traj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xm);
  __Pyx_XDECREF(__pyx_v_full_cov);
  __Pyx_XDECREF(__pyx_v_known_spaces);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_null_spaces);
  __Pyx_XDECREF(__pyx_v_full_fltrs);
  __Pyx_XDECREF(__pyx_v_null_space);
  __Pyx_XDECREF(__pyx_v_full_fltr_mat);
  __Pyx_XDECREF(__pyx_v_full_null_space);
  __Pyx_XDECREF(__pyx_v_xm_known);
  __Pyx_XDECREF(__pyx_v_obs_flattened);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XDECREF(__pyx_v_invcov);
  __Pyx_XDECREF(__pyx_v_cov_red);
  __Pyx_XDECREF(__pyx_v_xm_red);
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3347
 *         return xm_red, cov_red/self.Omega, full_null_space, known_spaces.flatten()
 * 
 *     def _split_spaces(self, fltr, obs):             # <<<<<<<<<<<<<<
 *         m, n = fltr.shape
 *         r, q = rq(fltr)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_129_split_spaces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_129_split_spaces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fltr = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_split_spaces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fltr,&__pyx_n_s_obs,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fltr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_split_spaces", 1, 2, 2, 1); __PYX_ERR(0, 3347, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_split_spaces") < 0)) __PYX_ERR(0, 3347, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_fltr = values[0];
    __pyx_v_obs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_split_spaces", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3347, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._split_spaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_128_split_spaces(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_fltr, __pyx_v_obs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_128_split_spaces(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_fltr, PyObject *__pyx_v_obs) {
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_q = NULL;
  PyObject *__pyx_v_null_space = NULL;
  PyObject *__pyx_v_known_space = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("_split_spaces", 0);

  /* "pyross/inference.pyx":3348
 * 
 *     def _split_spaces(self, fltr, obs):
 *         m, n = fltr.shape             # <<<<<<<<<<<<<<
 *         r, q = rq(fltr)
 *         null_space = q[:n-m]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fltr, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3348, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3348, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3348, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_m = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_n = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3349
 *     def _split_spaces(self, fltr, obs):
 *         m, n = fltr.shape
 *         r, q = rq(fltr)             # <<<<<<<<<<<<<<
 *         null_space = q[:n-m]
 *         known_space = (q[n-m:]).T  @ solve_triangular(r[:, n-m:], obs)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_rq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_fltr) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_fltr);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3349, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3349, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3349, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_q = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3350
 *         m, n = fltr.shape
 *         r, q = rq(fltr)
 *         null_space = q[:n-m]             # <<<<<<<<<<<<<<
 *         known_space = (q[n-m:]).T  @ solve_triangular(r[:, n-m:], obs)
 *         return null_space, known_space
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_n, __pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_q, 0, 0, NULL, &__pyx_t_1, NULL, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_null_space = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3351
 *         r, q = rq(fltr)
 *         null_space = q[:n-m]
 *         known_space = (q[n-m:]).T  @ solve_triangular(r[:, n-m:], obs)             # <<<<<<<<<<<<<<
 *         return null_space, known_space
 * 
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_n, __pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_q, 0, 0, &__pyx_t_2, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_solve_triangular); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Subtract(__pyx_v_n, __pyx_v_m); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PySlice_New(__pyx_t_4, Py_None, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_slice_);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_r, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_6, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3351, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_6, __pyx_v_obs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3351, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_obs);
    __Pyx_GIVEREF(__pyx_v_obs);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_obs);
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_known_space = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3352
 *         null_space = q[:n-m]
 *         known_space = (q[n-m:]).T  @ solve_triangular(r[:, n-m:], obs)
 *         return null_space, known_space             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_null_space);
  __Pyx_GIVEREF(__pyx_v_null_space);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_null_space);
  __Pyx_INCREF(__pyx_v_known_space);
  __Pyx_GIVEREF(__pyx_v_known_space);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_known_space);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3347
 *         return xm_red, cov_red/self.Omega, full_null_space, known_spaces.flatten()
 * 
 *     def _split_spaces(self, fltr, obs):             # <<<<<<<<<<<<<<
 *         m, n = fltr.shape
 *         r, q = rq(fltr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyross.inference.SIR_type._split_spaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_null_space);
  __Pyx_XDECREF(__pyx_v_known_space);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3355
 * 
 * 
 *     cdef double _obtain_logp_for_traj_tangent(self, double [:, :] x, double Tf):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] dx, cov
 */

static double __pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_traj_tangent(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_Tf) {
  __Pyx_memviewslice __pyx_v_dx = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xt = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_time_points = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dx_det = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dt;
  double __pyx_v_logp;
  double __pyx_v_t;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_Nf;
  PyObject *__pyx_v_dev = NULL;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_9;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("_obtain_logp_for_traj_tangent", 0);

  /* "pyross/inference.pyx":3360
 *             double [:] xt, time_points, dx_det
 *             double dt, logp, t
 *             Py_ssize_t i, Nf=x.shape[0]             # <<<<<<<<<<<<<<
 *         time_points = np.linspace(0, Tf, Nf)
 *         dt = time_points[2]
 */
  __pyx_v_Nf = (__pyx_v_x.shape[0]);

  /* "pyross/inference.pyx":3361
 *             double dt, logp, t
 *             Py_ssize_t i, Nf=x.shape[0]
 *         time_points = np.linspace(0, Tf, Nf)             # <<<<<<<<<<<<<<
 *         dt = time_points[2]
 *         dx = np.gradient(x, axis=0)*2
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_int_0, __pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_int_0, __pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_time_points = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "pyross/inference.pyx":3362
 *             Py_ssize_t i, Nf=x.shape[0]
 *         time_points = np.linspace(0, Tf, Nf)
 *         dt = time_points[2]             # <<<<<<<<<<<<<<
 *         dx = np.gradient(x, axis=0)*2
 *         logp = 0
 */
  __pyx_t_9 = 2;
  __pyx_v_dt = (*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_9 * __pyx_v_time_points.strides[0]) )));

  /* "pyross/inference.pyx":3363
 *         time_points = np.linspace(0, Tf, Nf)
 *         dt = time_points[2]
 *         dx = np.gradient(x, axis=0)*2             # <<<<<<<<<<<<<<
 *         logp = 0
 *         for i in range(1, Nf-1):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_gradient); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_x, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 3363, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_int_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dx = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "pyross/inference.pyx":3364
 *         dt = time_points[2]
 *         dx = np.gradient(x, axis=0)*2
 *         logp = 0             # <<<<<<<<<<<<<<
 *         for i in range(1, Nf-1):
 *             xt = x[i]
 */
  __pyx_v_logp = 0.0;

  /* "pyross/inference.pyx":3365
 *         dx = np.gradient(x, axis=0)*2
 *         logp = 0
 *         for i in range(1, Nf-1):             # <<<<<<<<<<<<<<
 *             xt = x[i]
 *             t = time_points[i]
 */
  __pyx_t_11 = (__pyx_v_Nf - 1);
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_13 = 1; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pyross/inference.pyx":3366
 *         logp = 0
 *         for i in range(1, Nf-1):
 *             xt = x[i]             # <<<<<<<<<<<<<<
 *             t = time_points[i]
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 */
    __pyx_t_8.data = __pyx_v_x.data;
    __pyx_t_8.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_x.strides[0];
        if ((0)) __PYX_ERR(0, 3366, __pyx_L1_error)
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_x.shape[1];
__pyx_t_8.strides[0] = __pyx_v_x.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xt, 1);
    __pyx_v_xt = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;

    /* "pyross/inference.pyx":3367
 *         for i in range(1, Nf-1):
 *             xt = x[i]
 *             t = time_points[i]             # <<<<<<<<<<<<<<
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(np.multiply(xt, self.Omega), t)
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_v_t = (*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_14 * __pyx_v_time_points.strides[0]) )));

    /* "pyross/inference.pyx":3368
 *             xt = x[i]
 *             t = time_points[i]
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)             # <<<<<<<<<<<<<<
 *             self.det_model.rhs(np.multiply(xt, self.Omega), t)
 *             dx_det = np.multiply(dt/self.Omega, self.det_model.dxdt)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_set_contactMatrix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_self->contactMatrix};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3368, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_self->contactMatrix};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3368, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_self->contactMatrix);
      __Pyx_GIVEREF(__pyx_v_self->contactMatrix);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_v_self->contactMatrix);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3369
 *             t = time_points[i]
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(np.multiply(xt, self.Omega), t)             # <<<<<<<<<<<<<<
 *             dx_det = np.multiply(dt/self.Omega, self.det_model.dxdt)
 *             self.compute_jacobian_and_b_matrix(xt, t)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_rhs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_multiply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_xt, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_4, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_4, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_16, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_7, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_7, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_3);
      __pyx_t_7 = 0;
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3370
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(np.multiply(xt, self.Omega), t)
 *             dx_det = np.multiply(dt/self.Omega, self.det_model.dxdt)             # <<<<<<<<<<<<<<
 *             self.compute_jacobian_and_b_matrix(xt, t)
 *             cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_multiply); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_dt / __pyx_v_self->Omega)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3370, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3370, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_7);
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3370, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_dx_det, 1);
    __pyx_v_dx_det = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;

    /* "pyross/inference.pyx":3371
 *             self.det_model.rhs(np.multiply(xt, self.Omega), t)
 *             dx_det = np.multiply(dt/self.Omega, self.det_model.dxdt)
 *             self.compute_jacobian_and_b_matrix(xt, t)             # <<<<<<<<<<<<<<
 *             cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 *             dev = np.subtract(dx[i], dx_det)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->compute_jacobian_and_b_matrix(__pyx_v_self, __pyx_v_xt, __pyx_v_t, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3372
 *             dx_det = np.multiply(dt/self.Omega, self.det_model.dxdt)
 *             self.compute_jacobian_and_b_matrix(xt, t)
 *             cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))             # <<<<<<<<<<<<<<
 *             dev = np.subtract(dx[i], dx_det)
 *             logp += self._log_cond_p(dev, cov)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_multiply); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->B_vec), PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3372, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->convert_vec_to_mat(__pyx_v_self, __pyx_t_8, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3372, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3372, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 3372, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
    __pyx_v_cov = __pyx_t_10;
    __pyx_t_10.memview = NULL;
    __pyx_t_10.data = NULL;

    /* "pyross/inference.pyx":3373
 *             self.compute_jacobian_and_b_matrix(xt, t)
 *             cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 *             dev = np.subtract(dx[i], dx_det)             # <<<<<<<<<<<<<<
 *             logp += self._log_cond_p(dev, cov)
 *         return -logp
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_subtract); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_8.data = __pyx_v_dx.data;
    __pyx_t_8.memview = __pyx_v_dx.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_dx.strides[0];
        if ((0)) __PYX_ERR(0, 3373, __pyx_L1_error)
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_dx.shape[1];
__pyx_t_8.strides[0] = __pyx_v_dx.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_16 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_dx_det, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_16, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3373, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_16, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3373, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_t_7);
      __pyx_t_16 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_dev, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3374
 *             cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 *             dev = np.subtract(dx[i], dx_det)
 *             logp += self._log_cond_p(dev, cov)             # <<<<<<<<<<<<<<
 *         return -logp
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dev, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3374, __pyx_L1_error)
    __pyx_v_logp = (__pyx_v_logp + ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_log_cond_p(__pyx_v_self, __pyx_t_8, __pyx_v_cov));
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
  }

  /* "pyross/inference.pyx":3375
 *             dev = np.subtract(dx[i], dx_det)
 *             logp += self._log_cond_p(dev, cov)
 *         return -logp             # <<<<<<<<<<<<<<
 * 
 *     cdef double _log_cond_p(self, double [:] x, double [:, :] cov):
 */
  __pyx_r = (-__pyx_v_logp);
  goto __pyx_L0;

  /* "pyross/inference.pyx":3355
 * 
 * 
 *     cdef double _obtain_logp_for_traj_tangent(self, double [:, :] x, double Tf):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] dx, cov
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_WriteUnraisable("pyross.inference.SIR_type._obtain_logp_for_traj_tangent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_dx, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xt, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_time_points, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dx_det, 1);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3377
 *         return -logp
 * 
 *     cdef double _log_cond_p(self, double [:] x, double [:, :] cov):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] invcov_x
 */

static double __pyx_f_6pyross_9inference_8SIR_type__log_cond_p(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_cov) {
  __Pyx_memviewslice __pyx_v_invcov_x = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_log_cond_p;
  PyObject *__pyx_v_ldet = NULL;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_10;
  __Pyx_RefNannySetupContext("_log_cond_p", 0);

  /* "pyross/inference.pyx":3382
 *             double log_cond_p
 *             double det
 *         invcov_x, ldet = pyross.utils.solve_symmetric_close_to_singular(cov, x)             # <<<<<<<<<<<<<<
 *         log_cond_p = - np.dot(x, invcov_x)*(self.Omega/2) - (self.dim/2)*log(2*PI)
 *         log_cond_p -= (ldet - self.dim*log(self.Omega))/2
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_solve_symmetric_close_to_singula); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_cov, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3382, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3382, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3382, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 3382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_invcov_x = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_ldet = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":3383
 *             double det
 *         invcov_x, ldet = pyross.utils.solve_symmetric_close_to_singular(cov, x)
 *         log_cond_p = - np.dot(x, invcov_x)*(self.Omega/2) - (self.dim/2)*log(2*PI)             # <<<<<<<<<<<<<<
 *         log_cond_p -= (ldet - self.dim*log(self.Omega))/2
 *         log_cond_p -= self.dim*np.log(self.Omega)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_invcov_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3383, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3383, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->Omega / 2.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_self->dim / 2) * log((2.0 * __pyx_v_6pyross_9inference_PI)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3383, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_log_cond_p = __pyx_t_10;

  /* "pyross/inference.pyx":3384
 *         invcov_x, ldet = pyross.utils.solve_symmetric_close_to_singular(cov, x)
 *         log_cond_p = - np.dot(x, invcov_x)*(self.Omega/2) - (self.dim/2)*log(2*PI)
 *         log_cond_p -= (ldet - self.dim*log(self.Omega))/2             # <<<<<<<<<<<<<<
 *         log_cond_p -= self.dim*np.log(self.Omega)
 *         return log_cond_p
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_log_cond_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->dim * log(__pyx_v_self->Omega))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Subtract(__pyx_v_ldet, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_5, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_log_cond_p = __pyx_t_10;

  /* "pyross/inference.pyx":3385
 *         log_cond_p = - np.dot(x, invcov_x)*(self.Omega/2) - (self.dim/2)*log(2*PI)
 *         log_cond_p -= (ldet - self.dim*log(self.Omega))/2
 *         log_cond_p -= self.dim*np.log(self.Omega)             # <<<<<<<<<<<<<<
 *         return log_cond_p
 * 
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_log_cond_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_log_cond_p = __pyx_t_10;

  /* "pyross/inference.pyx":3386
 *         log_cond_p -= (ldet - self.dim*log(self.Omega))/2
 *         log_cond_p -= self.dim*np.log(self.Omega)
 *         return log_cond_p             # <<<<<<<<<<<<<<
 * 
 *     cdef _estimate_cond_cov(self, object sol, double t1, double t2):
 */
  __pyx_r = __pyx_v_log_cond_p;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3377
 *         return -logp
 * 
 *     cdef double _log_cond_p(self, double [:] x, double [:, :] cov):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] invcov_x
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_WriteUnraisable("pyross.inference.SIR_type._log_cond_p", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_invcov_x, 1);
  __Pyx_XDECREF(__pyx_v_ldet);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3393
 *             double [:, :] cov
 * 
 *         def rhs(t, sig):             # <<<<<<<<<<<<<<
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_18_estimate_cond_cov_1rhs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_18_estimate_cond_cov_1rhs = {"rhs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_18_estimate_cond_cov_1rhs, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_18_estimate_cond_cov_1rhs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_sig = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rhs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_sig,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sig)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rhs", 1, 2, 2, 1); __PYX_ERR(0, 3393, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rhs") < 0)) __PYX_ERR(0, 3393, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_t = values[0];
    __pyx_v_sig = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rhs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3393, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._estimate_cond_cov.rhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_18_estimate_cond_cov_rhs(__pyx_self, __pyx_v_t, __pyx_v_sig);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_18_estimate_cond_cov_rhs(PyObject *__pyx_self, PyObject *__pyx_v_t, PyObject *__pyx_v_sig) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *__pyx_outer_scope;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_5;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix __pyx_t_6;
  __Pyx_RefNannySetupContext("rhs", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":3394
 * 
 *         def rhs(t, sig):
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables             # <<<<<<<<<<<<<<
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 *             self._compute_dsigdt(sig)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_sol)) { __Pyx_RaiseClosureNameError("sol"); __PYX_ERR(0, 3394, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sol);
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_sol; __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3394, __pyx_L1_error) }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_x = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3395
 *         def rhs(t, sig):
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)             # <<<<<<<<<<<<<<
 *             self._compute_dsigdt(sig)
 *             return self.dsigmadt
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3395, __pyx_L1_error) }
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3395, __pyx_L1_error)
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3395, __pyx_L1_error)
  __pyx_t_6.__pyx_n = 2;
  __pyx_t_6.b_matrix = Py_True;
  __pyx_t_6.jacobian = Py_True;
  __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->compute_jacobian_and_b_matrix(__pyx_cur_scope->__pyx_v_self, __pyx_t_4, __pyx_t_5, &__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3396
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 *             self._compute_dsigdt(sig)             # <<<<<<<<<<<<<<
 *             return self.dsigmadt
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3396, __pyx_L1_error) }
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_sig, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3396, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_compute_dsigdt(__pyx_cur_scope->__pyx_v_self, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3397
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 *             self._compute_dsigdt(sig)
 *             return self.dsigmadt             # <<<<<<<<<<<<<<
 * 
 *         cov_vec = self._solve_lyapunov_type_eq(rhs, sigma0, t1, t2, self.steps)
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3397, __pyx_L1_error) }
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->dsigmadt));
  __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self->dsigmadt);
  goto __pyx_L0;

  /* "pyross/inference.pyx":3393
 *             double [:, :] cov
 * 
 *         def rhs(t, sig):             # <<<<<<<<<<<<<<
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._estimate_cond_cov.rhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3388
 *         return log_cond_p
 * 
 *     cdef _estimate_cond_cov(self, object sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] cov_vec, sigma0=np.zeros((self.vec_size), dtype=DTYPE)
 */

static PyObject *__pyx_f_6pyross_9inference_8SIR_type__estimate_cond_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *__pyx_cur_scope;
  __Pyx_memviewslice __pyx_v_cov_vec = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_sigma0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_rhs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannySetupContext("_estimate_cond_cov", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov(__pyx_ptype_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3388, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_sol = __pyx_v_sol;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sol);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sol);

  /* "pyross/inference.pyx":3390
 *     cdef _estimate_cond_cov(self, object sol, double t1, double t2):
 *         cdef:
 *             double [:] cov_vec, sigma0=np.zeros((self.vec_size), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             double [:, :] cov
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->vec_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_sigma0 = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":3393
 *             double [:, :] cov
 * 
 *         def rhs(t, sig):             # <<<<<<<<<<<<<<
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_18_estimate_cond_cov_1rhs, 0, __pyx_n_s_SIR_type__estimate_cond_cov_loca, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_rhs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3399
 *             return self.dsigmadt
 * 
 *         cov_vec = self._solve_lyapunov_type_eq(rhs, sigma0, t1, t2, self.steps)             # <<<<<<<<<<<<<<
 *         cov = self.convert_vec_to_mat(cov_vec)
 *         return cov
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_solve_lyapunov_type_eq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_sigma0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->steps); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_rhs, __pyx_t_3, __pyx_t_2, __pyx_t_6, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_rhs, __pyx_t_3, __pyx_t_2, __pyx_t_6, __pyx_t_7};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_rhs);
    __Pyx_GIVEREF(__pyx_v_rhs);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_rhs);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_cov_vec = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":3400
 * 
 *         cov_vec = self._solve_lyapunov_type_eq(rhs, sigma0, t1, t2, self.steps)
 *         cov = self.convert_vec_to_mat(cov_vec)             # <<<<<<<<<<<<<<
 *         return cov
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->convert_vec_to_mat(__pyx_cur_scope->__pyx_v_self, __pyx_v_cov_vec, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 3400, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_cov = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "pyross/inference.pyx":3401
 *         cov_vec = self._solve_lyapunov_type_eq(rhs, sigma0, t1, t2, self.steps)
 *         cov = self.convert_vec_to_mat(cov_vec)
 *         return cov             # <<<<<<<<<<<<<<
 * 
 *     cpdef obtain_full_mean_cov(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_cov, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3388
 *         return log_cond_p
 * 
 *     cdef _estimate_cond_cov(self, object sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] cov_vec, sigma0=np.zeros((self.vec_size), dtype=DTYPE)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._estimate_cond_cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov_vec, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_sigma0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
  __Pyx_XDECREF(__pyx_v_rhs);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3403
 *         return cov
 * 
 *     cpdef obtain_full_mean_cov(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_131obtain_full_mean_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_obtain_full_mean_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov *__pyx_optional_args) {
  Py_ssize_t __pyx_v_inter_steps = ((Py_ssize_t)0);
  Py_ssize_t __pyx_v_dim;
  Py_ssize_t __pyx_v_i;
  __Pyx_memviewslice __pyx_v_xm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v__xm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_time_points = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cond_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_full_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_ti;
  double __pyx_v_tf;
  PyObject *__pyx_v_times = NULL;
  PyObject *__pyx_v_sol = NULL;
  Py_ssize_t __pyx_v_j;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  __Pyx_memviewslice __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_26 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_27 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannySetupContext("obtain_full_mean_cov", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_inter_steps = __pyx_optional_args->inter_steps;
    }
  }
  __PYX_INC_MEMVIEW(&__pyx_v_x0, 1);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_obtain_full_mean_cov); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_131obtain_full_mean_cov)) {
        __Pyx_XDECREF(__pyx_r);
        if (unlikely(!__pyx_v_x0.memview)) { __Pyx_RaiseUnboundLocalError("x0"); __PYX_ERR(0, 3403, __pyx_L1_error) }
        __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3403, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3403, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3403, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_inter_steps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3403, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1; __pyx_t_8 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3403, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3403, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(4+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3403, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_6);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_5 = 0;
          __pyx_t_6 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3403, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3405
 *     cpdef obtain_full_mean_cov(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):
 *         cdef:
 *             Py_ssize_t dim=self.dim, i             # <<<<<<<<<<<<<<
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)
 *             double [:, :] _xm=np.empty((inter_steps*Nf, dim), dtype=DTYPE)
 */
  __pyx_t_11 = __pyx_v_self->dim;
  __pyx_v_dim = __pyx_t_11;

  /* "pyross/inference.pyx":3406
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             double [:, :] _xm=np.empty((inter_steps*Nf, dim), dtype=DTYPE)
 *             double [:] time_points=np.linspace(0, Tf, Nf)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_xm = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "pyross/inference.pyx":3407
 *             Py_ssize_t dim=self.dim, i
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)
 *             double [:, :] _xm=np.empty((inter_steps*Nf, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             double [:] time_points=np.linspace(0, Tf, Nf)
 *             double [:] xi, xf
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_inter_steps * __pyx_v_Nf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3407, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__xm = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "pyross/inference.pyx":3408
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)
 *             double [:, :] _xm=np.empty((inter_steps*Nf, dim), dtype=DTYPE)
 *             double [:] time_points=np.linspace(0, Tf, Nf)             # <<<<<<<<<<<<<<
 *             double [:] xi, xf
 *             double [:, :] cond_cov, cov, temp
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_6 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_2, __pyx_t_10};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3408, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_2, __pyx_t_10};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3408, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_9, __pyx_t_10);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 3408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_time_points = __pyx_t_13;
  __pyx_t_13.memview = NULL;
  __pyx_t_13.data = NULL;

  /* "pyross/inference.pyx":3413
 *             double [:, :, :, :] full_cov
 *             double ti, tf
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,
 */
  __pyx_t_14 = (__pyx_v_inter_steps != 0);
  if (__pyx_t_14) {

    /* "pyross/inference.pyx":3414
 *             double ti, tf
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)             # <<<<<<<<<<<<<<
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,
 *                                                                 0, Tf,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_multiply); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3414, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3414, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_10);
      __pyx_t_7 = 0;
      __pyx_t_10 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 3414, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
    __pyx_v_x0 = __pyx_t_13;
    __pyx_t_13.memview = NULL;
    __pyx_t_13.data = NULL;

    /* "pyross/inference.pyx":3415
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,             # <<<<<<<<<<<<<<
 *                                                                 0, Tf,
 *                                                                 Nf, inter_steps)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_forward_euler_integration); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rhs0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);

    /* "pyross/inference.pyx":3416
 *             x0 = np.multiply(x0, self.Omega)
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,
 *                                                                 0, Tf,             # <<<<<<<<<<<<<<
 *                                                                 Nf, inter_steps)
 *             _xm = np.divide(_xm, self.Omega)
 */
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "pyross/inference.pyx":3417
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,
 *                                                                 0, Tf,
 *                                                                 Nf, inter_steps)             # <<<<<<<<<<<<<<
 *             _xm = np.divide(_xm, self.Omega)
 *             self._xm = np.copy(_xm)
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_inter_steps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_t_6, __pyx_t_10, __pyx_int_0, __pyx_t_7, __pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3415, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_t_6, __pyx_t_10, __pyx_int_0, __pyx_t_7, __pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3415, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_10);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_9, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_9, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_9, __pyx_t_4);
      __pyx_t_6 = 0;
      __pyx_t_10 = 0;
      __pyx_t_7 = 0;
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3415
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,             # <<<<<<<<<<<<<<
 *                                                                 0, Tf,
 *                                                                 Nf, inter_steps)
 */
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3415, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v__xm, 1);
    __pyx_v__xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3418
 *                                                                 0, Tf,
 *                                                                 Nf, inter_steps)
 *             _xm = np.divide(_xm, self.Omega)             # <<<<<<<<<<<<<<
 *             self._xm = np.copy(_xm)
 *             self._interp = []
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_divide); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v__xm, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3418, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3418, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3418, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v__xm, 1);
    __pyx_v__xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3419
 *                                                                 Nf, inter_steps)
 *             _xm = np.divide(_xm, self.Omega)
 *             self._xm = np.copy(_xm)             # <<<<<<<<<<<<<<
 *             self._interp = []
 *             times = np.linspace(0, Nf, inter_steps*Nf)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_copy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v__xm, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3419, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_xm);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_xm));
    __pyx_v_self->_xm = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3420
 *             _xm = np.divide(_xm, self.Omega)
 *             self._xm = np.copy(_xm)
 *             self._interp = []             # <<<<<<<<<<<<<<
 *             times = np.linspace(0, Nf, inter_steps*Nf)
 *             for i in range(dim):
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_interp);
    __Pyx_DECREF(__pyx_v_self->_interp);
    __pyx_v_self->_interp = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3421
 *             self._xm = np.copy(_xm)
 *             self._interp = []
 *             times = np.linspace(0, Nf, inter_steps*Nf)             # <<<<<<<<<<<<<<
 *             for i in range(dim):
 *                 self._interp.append(interpolate.interp1d(times, _xm[:,i],
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_inter_steps * __pyx_v_Nf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_int_0, __pyx_t_7, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3421, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_int_0, __pyx_t_7, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3421, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_9, __pyx_t_4);
      __pyx_t_7 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_times = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3422
 *             self._interp = []
 *             times = np.linspace(0, Nf, inter_steps*Nf)
 *             for i in range(dim):             # <<<<<<<<<<<<<<
 *                 self._interp.append(interpolate.interp1d(times, _xm[:,i],
 *                                                           kind='linear'))
 */
    __pyx_t_11 = __pyx_v_dim;
    __pyx_t_15 = __pyx_t_11;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_v_i = __pyx_t_16;

      /* "pyross/inference.pyx":3423
 *             times = np.linspace(0, Nf, inter_steps*Nf)
 *             for i in range(dim):
 *                 self._interp.append(interpolate.interp1d(times, _xm[:,i],             # <<<<<<<<<<<<<<
 *                                                           kind='linear'))
 *             xm = _xm[::inter_steps]
 */
      if (unlikely(__pyx_v_self->_interp == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(0, 3423, __pyx_L1_error)
      }
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_interpolate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_interp1d); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13.data = __pyx_v__xm.data;
      __pyx_t_13.memview = __pyx_v__xm.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_13, 0);
      __pyx_t_13.shape[0] = __pyx_v__xm.shape[0];
__pyx_t_13.strides[0] = __pyx_v__xm.strides[0];
    __pyx_t_13.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v__xm.strides[1];
        if ((0)) __PYX_ERR(0, 3423, __pyx_L1_error)
        __pyx_t_13.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_13, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
      __pyx_t_13.memview = NULL;
      __pyx_t_13.data = NULL;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_times);
      __Pyx_GIVEREF(__pyx_v_times);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_times);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":3424
 *             for i in range(dim):
 *                 self._interp.append(interpolate.interp1d(times, _xm[:,i],
 *                                                           kind='linear'))             # <<<<<<<<<<<<<<
 *             xm = _xm[::inter_steps]
 *             sol = self.interpolate_euler
 */
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_kind, __pyx_n_u_linear) < 0) __PYX_ERR(0, 3424, __pyx_L1_error)

      /* "pyross/inference.pyx":3423
 *             times = np.linspace(0, Nf, inter_steps*Nf)
 *             for i in range(dim):
 *                 self._interp.append(interpolate.interp1d(times, _xm[:,i],             # <<<<<<<<<<<<<<
 *                                                           kind='linear'))
 *             xm = _xm[::inter_steps]
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_self->_interp, __pyx_t_4); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }

    /* "pyross/inference.pyx":3425
 *                 self._interp.append(interpolate.interp1d(times, _xm[:,i],
 *                                                           kind='linear'))
 *             xm = _xm[::inter_steps]             # <<<<<<<<<<<<<<
 *             sol = self.interpolate_euler
 *         else:
 */
    __pyx_t_12.data = __pyx_v__xm.data;
    __pyx_t_12.memview = __pyx_v__xm.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_12, 0);
    __pyx_t_9 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_12,
    __pyx_v__xm.shape[0], __pyx_v__xm.strides[0], __pyx_v__xm.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    0,
    0,
    __pyx_v_inter_steps,
    0,
    0,
    1,
    1) < 0))
{
    __PYX_ERR(0, 3425, __pyx_L1_error)
}

__pyx_t_12.shape[1] = __pyx_v__xm.shape[1];
__pyx_t_12.strides[1] = __pyx_v__xm.strides[1];
    __pyx_t_12.suboffsets[1] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
    __pyx_v_xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3426
 *                                                           kind='linear'))
 *             xm = _xm[::inter_steps]
 *             sol = self.interpolate_euler             # <<<<<<<<<<<<<<
 *         else:
 *             xm, sol = self.integrate(x0, 0, Tf, Nf, dense_output=True,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_interpolate_euler); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_sol = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":3413
 *             double [:, :, :, :] full_cov
 *             double ti, tf
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             _xm = pyross.utils.forward_euler_integration(self._rhs0, x0,
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3428
 *             sol = self.interpolate_euler
 *         else:
 *             xm, sol = self.integrate(x0, 0, Tf, Nf, dense_output=True,             # <<<<<<<<<<<<<<
 *                                            maxNumSteps=self.steps*Nf)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_integrate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dense_output, Py_True) < 0) __PYX_ERR(0, 3428, __pyx_L1_error)

    /* "pyross/inference.pyx":3429
 *         else:
 *             xm, sol = self.integrate(x0, 0, Tf, Nf, dense_output=True,
 *                                            maxNumSteps=self.steps*Nf)             # <<<<<<<<<<<<<<
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 */
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_self->steps * __pyx_v_Nf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_maxNumSteps, __pyx_t_2) < 0) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":3428
 *             sol = self.interpolate_euler
 *         else:
 *             xm, sol = self.integrate(x0, 0, Tf, Nf, dense_output=True,             # <<<<<<<<<<<<<<
 *                                            maxNumSteps=self.steps*Nf)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3428, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_18(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_7 = __pyx_t_18(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3428, __pyx_L1_error)
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3428, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3428, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
    __pyx_v_xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;
    __pyx_v_sol = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3430
 *             xm, sol = self.integrate(x0, 0, Tf, Nf, dense_output=True,
 *                                            maxNumSteps=self.steps*Nf)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 *         for i in range(Nf-1):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cov = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "pyross/inference.pyx":3431
 *                                            maxNumSteps=self.steps*Nf)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         for i in range(Nf-1):
 *             ti = time_points[i]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_7 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 3431, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_full_cov = __pyx_t_19;
  __pyx_t_19.memview = NULL;
  __pyx_t_19.data = NULL;

  /* "pyross/inference.pyx":3432
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 *         for i in range(Nf-1):             # <<<<<<<<<<<<<<
 *             ti = time_points[i]
 *             tf = time_points[i+1]
 */
  __pyx_t_11 = (__pyx_v_Nf - 1);
  __pyx_t_15 = __pyx_t_11;
  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
    __pyx_v_i = __pyx_t_16;

    /* "pyross/inference.pyx":3433
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 *         for i in range(Nf-1):
 *             ti = time_points[i]             # <<<<<<<<<<<<<<
 *             tf = time_points[i+1]
 *             cond_cov = self._estimate_cond_cov(sol, ti, tf)
 */
    __pyx_t_20 = __pyx_v_i;
    __pyx_v_ti = (*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_20 * __pyx_v_time_points.strides[0]) )));

    /* "pyross/inference.pyx":3434
 *         for i in range(Nf-1):
 *             ti = time_points[i]
 *             tf = time_points[i+1]             # <<<<<<<<<<<<<<
 *             cond_cov = self._estimate_cond_cov(sol, ti, tf)
 *             self._obtain_time_evol_op(sol, ti, tf)
 */
    __pyx_t_21 = (__pyx_v_i + 1);
    __pyx_v_tf = (*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_21 * __pyx_v_time_points.strides[0]) )));

    /* "pyross/inference.pyx":3435
 *             ti = time_points[i]
 *             tf = time_points[i+1]
 *             cond_cov = self._estimate_cond_cov(sol, ti, tf)             # <<<<<<<<<<<<<<
 *             self._obtain_time_evol_op(sol, ti, tf)
 *             cov = np.add(self.U@cov@self.U.T, cond_cov)
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->_estimate_cond_cov(__pyx_v_self, __pyx_v_sol, __pyx_v_ti, __pyx_v_tf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3435, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3435, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_cond_cov, 1);
    __pyx_v_cond_cov = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3436
 *             tf = time_points[i+1]
 *             cond_cov = self._estimate_cond_cov(sol, ti, tf)
 *             self._obtain_time_evol_op(sol, ti, tf)             # <<<<<<<<<<<<<<
 *             cov = np.add(self.U@cov@self.U.T, cond_cov)
 *             full_cov[i, :, i, :] = cov
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_obtain_time_evol_op); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_ti); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_sol, __pyx_t_1, __pyx_t_4};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3436, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_sol, __pyx_t_1, __pyx_t_4};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3436, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_sol);
      __Pyx_GIVEREF(__pyx_v_sol);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_sol);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_9, __pyx_t_4);
      __pyx_t_1 = 0;
      __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3437
 *             cond_cov = self._estimate_cond_cov(sol, ti, tf)
 *             self._obtain_time_evol_op(sol, ti, tf)
 *             cov = np.add(self.U@cov@self.U.T, cond_cov)             # <<<<<<<<<<<<<<
 *             full_cov[i, :, i, :] = cov
 *             if i>0:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_add); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_cov, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyNumber_MatrixMultiply(((PyObject *)__pyx_v_self->U), __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->U), __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_cond_cov, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3437, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3437, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_5);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3437, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
    __pyx_v_cov = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3438
 *             self._obtain_time_evol_op(sol, ti, tf)
 *             cov = np.add(self.U@cov@self.U.T, cond_cov)
 *             full_cov[i, :, i, :] = cov             # <<<<<<<<<<<<<<
 *             if i>0:
 *                 for j in range(0, i):
 */
    __pyx_t_12.data = __pyx_v_full_cov.data;
    __pyx_t_12.memview = __pyx_v_full_cov.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_12, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3438, __pyx_L1_error)
        __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_12.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_12.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_12.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3438, __pyx_L1_error)
        __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_12.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_12.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_12.suboffsets[1] = -1;

if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_cov, __pyx_t_12, 2, 2, 0) < 0)) __PYX_ERR(0, 3438, __pyx_L1_error)
    __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3439
 *             cov = np.add(self.U@cov@self.U.T, cond_cov)
 *             full_cov[i, :, i, :] = cov
 *             if i>0:             # <<<<<<<<<<<<<<
 *                 for j in range(0, i):
 *                     temp = full_cov[j, :, i-1, :]@self.U.T
 */
    __pyx_t_14 = ((__pyx_v_i > 0) != 0);
    if (__pyx_t_14) {

      /* "pyross/inference.pyx":3440
 *             full_cov[i, :, i, :] = cov
 *             if i>0:
 *                 for j in range(0, i):             # <<<<<<<<<<<<<<
 *                     temp = full_cov[j, :, i-1, :]@self.U.T
 *                     full_cov[j, :, i, :] = temp
 */
      __pyx_t_22 = __pyx_v_i;
      __pyx_t_23 = __pyx_t_22;
      for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
        __pyx_v_j = __pyx_t_24;

        /* "pyross/inference.pyx":3441
 *             if i>0:
 *                 for j in range(0, i):
 *                     temp = full_cov[j, :, i-1, :]@self.U.T             # <<<<<<<<<<<<<<
 *                     full_cov[j, :, i, :] = temp
 *                     full_cov[i, :, j, :] = temp.T
 */
        __pyx_t_25.data = __pyx_v_full_cov.data;
        __pyx_t_25.memview = __pyx_v_full_cov.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
        {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3441, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_25.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_25.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = (__pyx_v_i - 1);
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3441, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_25.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_25.suboffsets[1] = -1;

__pyx_t_7 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3441, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->U), __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3441, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3441, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 3441, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1);
        __pyx_v_temp = __pyx_t_25;
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;

        /* "pyross/inference.pyx":3442
 *                 for j in range(0, i):
 *                     temp = full_cov[j, :, i-1, :]@self.U.T
 *                     full_cov[j, :, i, :] = temp             # <<<<<<<<<<<<<<
 *                     full_cov[i, :, j, :] = temp.T
 *         # returns mean and cov for all but first (fixed!) time point
 */
        __pyx_t_25.data = __pyx_v_full_cov.data;
        __pyx_t_25.memview = __pyx_v_full_cov.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
        {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3442, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_25.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_25.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3442, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_25.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_25.suboffsets[1] = -1;

if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_temp, __pyx_t_25, 2, 2, 0) < 0)) __PYX_ERR(0, 3442, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;

        /* "pyross/inference.pyx":3443
 *                     temp = full_cov[j, :, i-1, :]@self.U.T
 *                     full_cov[j, :, i, :] = temp
 *                     full_cov[i, :, j, :] = temp.T             # <<<<<<<<<<<<<<
 *         # returns mean and cov for all but first (fixed!) time point
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim))
 */
        __pyx_t_26 = __pyx_v_temp;
        __PYX_INC_MEMVIEW(&__pyx_t_26, 1);
        if (unlikely(__pyx_memslice_transpose(&__pyx_t_26) == 0)) __PYX_ERR(0, 3443, __pyx_L1_error)
        __pyx_t_27.data = __pyx_v_full_cov.data;
        __pyx_t_27.memview = __pyx_v_full_cov.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_27, 0);
        {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3443, __pyx_L1_error)
        __pyx_t_27.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_27.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_27.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_27.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3443, __pyx_L1_error)
        __pyx_t_27.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_27.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_27.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_27.suboffsets[1] = -1;

if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_26, __pyx_t_27, 2, 2, 0) < 0)) __PYX_ERR(0, 3443, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_27, 1);
        __pyx_t_27.memview = NULL;
        __pyx_t_27.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
        __pyx_t_26.memview = NULL;
        __pyx_t_26.data = NULL;
      }

      /* "pyross/inference.pyx":3439
 *             cov = np.add(self.U@cov@self.U.T, cond_cov)
 *             full_cov[i, :, i, :] = cov
 *             if i>0:             # <<<<<<<<<<<<<<
 *                 for j in range(0, i):
 *                     temp = full_cov[j, :, i-1, :]@self.U.T
 */
    }
  }

  /* "pyross/inference.pyx":3445
 *                     full_cov[i, :, j, :] = temp.T
 *         # returns mean and cov for all but first (fixed!) time point
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim))             # <<<<<<<<<<<<<<
 * 
 *     cpdef interpolate_euler(self, t):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_26.data = __pyx_v_xm.data;
  __pyx_t_26.memview = __pyx_v_xm.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_26, 0);
  __pyx_t_9 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_26,
    __pyx_v_xm.shape[0], __pyx_v_xm.strides[0], __pyx_v_xm.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    1,
    0,
    0,
    1,
    0,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3445, __pyx_L1_error)
}

__pyx_t_26.shape[1] = __pyx_v_xm.shape[1];
__pyx_t_26.strides[1] = __pyx_v_xm.strides[1];
    __pyx_t_26.suboffsets[1] = -1;

__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_26, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
  __pyx_t_26.memview = NULL;
  __pyx_t_26.data = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_reshape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_full_cov, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyInt_FromSsize_t(((__pyx_v_Nf - 1) * __pyx_v_dim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyInt_FromSsize_t(((__pyx_v_Nf - 1) * __pyx_v_dim)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3445, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3445, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_t_10);
    __pyx_t_7 = 0;
    __pyx_t_10 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_8 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3403
 *         return cov
 * 
 *     cpdef obtain_full_mean_cov(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_27, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_full_mean_cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v__xm, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_time_points, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cond_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_full_cov, 1);
  __Pyx_XDECREF(__pyx_v_times);
  __Pyx_XDECREF(__pyx_v_sol);
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_131obtain_full_mean_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_131obtain_full_mean_cov(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_x0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_Tf;
  Py_ssize_t __pyx_v_Nf;
  Py_ssize_t __pyx_v_inter_steps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("obtain_full_mean_cov (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x0,&__pyx_n_s_Tf,&__pyx_n_s_Nf,&__pyx_n_s_inter_steps,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_full_mean_cov", 0, 3, 4, 1); __PYX_ERR(0, 3403, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Nf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_full_mean_cov", 0, 3, 4, 2); __PYX_ERR(0, 3403, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "obtain_full_mean_cov") < 0)) __PYX_ERR(0, 3403, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x0 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x0.memview)) __PYX_ERR(0, 3403, __pyx_L3_error)
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3403, __pyx_L3_error)
    __pyx_v_Nf = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_Nf == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3403, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_inter_steps = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_inter_steps == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3403, __pyx_L3_error)
    } else {
      __pyx_v_inter_steps = ((Py_ssize_t)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("obtain_full_mean_cov", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3403, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_full_mean_cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_130obtain_full_mean_cov(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, __pyx_v_inter_steps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_130obtain_full_mean_cov(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, Py_ssize_t __pyx_v_inter_steps) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov __pyx_t_2;
  __Pyx_RefNannySetupContext("obtain_full_mean_cov", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_x0.memview)) { __Pyx_RaiseUnboundLocalError("x0"); __PYX_ERR(0, 3403, __pyx_L1_error) }
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.inter_steps = __pyx_v_inter_steps;
  __pyx_t_1 = __pyx_vtabptr_6pyross_9inference_SIR_type->obtain_full_mean_cov(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_full_mean_cov", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3447
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim))
 * 
 *     cpdef interpolate_euler(self, t):             # <<<<<<<<<<<<<<
 *         ip = []
 *         for i in range(self.dim):
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_133interpolate_euler(PyObject *__pyx_v_self, PyObject *__pyx_v_t); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_interpolate_euler(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_ip = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("interpolate_euler", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_interpolate_euler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_133interpolate_euler)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_t);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3448
 * 
 *     cpdef interpolate_euler(self, t):
 *         ip = []             # <<<<<<<<<<<<<<
 *         for i in range(self.dim):
 *             ip.append(self._interp[i](t))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ip = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3449
 *     cpdef interpolate_euler(self, t):
 *         ip = []
 *         for i in range(self.dim):             # <<<<<<<<<<<<<<
 *             ip.append(self._interp[i](t))
 *         return np.asarray(ip).T
 */
  __pyx_t_5 = __pyx_v_self->dim;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pyross/inference.pyx":3450
 *         ip = []
 *         for i in range(self.dim):
 *             ip.append(self._interp[i](t))             # <<<<<<<<<<<<<<
 *         return np.asarray(ip).T
 * 
 */
    if (unlikely(__pyx_v_self->_interp == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 3450, __pyx_L1_error)
    }
    __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_self->_interp, __pyx_v_i));
    __pyx_t_2 = PyList_GET_ITEM(__pyx_v_self->_interp, __pyx_v_i); __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ip, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 3450, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyross/inference.pyx":3451
 *         for i in range(self.dim):
 *             ip.append(self._interp[i](t))
 *         return np.asarray(ip).T             # <<<<<<<<<<<<<<
 * 
 *     cpdef obtain_full_mean_cov_tangent_space(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_ip) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_ip);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_T); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3447
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim))
 * 
 *     cpdef interpolate_euler(self, t):             # <<<<<<<<<<<<<<
 *         ip = []
 *         for i in range(self.dim):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type.interpolate_euler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_133interpolate_euler(PyObject *__pyx_v_self, PyObject *__pyx_v_t); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_133interpolate_euler(PyObject *__pyx_v_self, PyObject *__pyx_v_t) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("interpolate_euler (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_132interpolate_euler(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyObject *)__pyx_v_t));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_132interpolate_euler(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("interpolate_euler", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pyross_9inference_8SIR_type_interpolate_euler(__pyx_v_self, __pyx_v_t, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.interpolate_euler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3453
 *         return np.asarray(ip).T
 * 
 *     cpdef obtain_full_mean_cov_tangent_space(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_135obtain_full_mean_cov_tangent_space(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space *__pyx_optional_args) {
  Py_ssize_t __pyx_v_inter_steps = ((Py_ssize_t)0);
  Py_ssize_t __pyx_v_dim;
  Py_ssize_t __pyx_v_i;
  __Pyx_memviewslice __pyx_v_xm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_time_points = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xt = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_cond_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_U = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J_dt = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_full_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_t;
  double __pyx_v_dt;
  Py_ssize_t __pyx_v_j;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_26 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_27 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannySetupContext("obtain_full_mean_cov_tangent_space", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_inter_steps = __pyx_optional_args->inter_steps;
    }
  }
  __PYX_INC_MEMVIEW(&__pyx_v_x0, 1);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_obtain_full_mean_cov_tangent_spa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3453, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_135obtain_full_mean_cov_tangent_space)) {
        __Pyx_XDECREF(__pyx_r);
        if (unlikely(!__pyx_v_x0.memview)) { __Pyx_RaiseUnboundLocalError("x0"); __PYX_ERR(0, 3453, __pyx_L1_error) }
        __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_inter_steps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1; __pyx_t_8 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3453, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3453, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(4+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3453, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_6);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_5 = 0;
          __pyx_t_6 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3453, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3455
 *     cpdef obtain_full_mean_cov_tangent_space(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):
 *         cdef:
 *             Py_ssize_t dim=self.dim, i             # <<<<<<<<<<<<<<
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)
 *             double [:] time_points=np.linspace(0, Tf, Nf)
 */
  __pyx_t_11 = __pyx_v_self->dim;
  __pyx_v_dim = __pyx_t_11;

  /* "pyross/inference.pyx":3456
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             double [:] time_points=np.linspace(0, Tf, Nf)
 *             double [:] xt
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_xm = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "pyross/inference.pyx":3457
 *             Py_ssize_t dim=self.dim, i
 *             double [:, :] xm=np.empty((Nf, dim), dtype=DTYPE)
 *             double [:] time_points=np.linspace(0, Tf, Nf)             # <<<<<<<<<<<<<<
 *             double [:] xt
 *             double [:, :] cov, cond_cov, U, J_dt, temp
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_10, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3457, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_10, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3457, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_9, __pyx_t_2);
    __pyx_t_10 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 3457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_time_points = __pyx_t_13;
  __pyx_t_13.memview = NULL;
  __pyx_t_13.data = NULL;

  /* "pyross/inference.pyx":3461
 *             double [:, :] cov, cond_cov, U, J_dt, temp
 *             double [:, :, :, :] full_cov
 *             double t, dt=time_points[1]             # <<<<<<<<<<<<<<
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 */
  __pyx_t_14 = 1;
  __pyx_v_dt = (*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_14 * __pyx_v_time_points.strides[0]) )));

  /* "pyross/inference.pyx":3462
 *             double [:, :, :, :] full_cov
 *             double t, dt=time_points[1]
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,
 */
  __pyx_t_15 = (__pyx_v_inter_steps != 0);
  if (__pyx_t_15) {

    /* "pyross/inference.pyx":3463
 *             double t, dt=time_points[1]
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)             # <<<<<<<<<<<<<<
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,
 *                                                         Nf, inter_steps)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_multiply); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_7, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3463, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_7, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3463, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_2);
      __pyx_t_7 = 0;
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 3463, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
    __pyx_v_x0 = __pyx_t_13;
    __pyx_t_13.memview = NULL;
    __pyx_t_13.data = NULL;

    /* "pyross/inference.pyx":3464
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,             # <<<<<<<<<<<<<<
 *                                                         Nf, inter_steps)
 *             xm = xm[::inter_steps]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_forward_euler_integration); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rhs0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "pyross/inference.pyx":3465
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,
 *                                                         Nf, inter_steps)             # <<<<<<<<<<<<<<
 *             xm = xm[::inter_steps]
 *             xm = np.divide(xm, self.Omega)
 */
    __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_inter_steps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_t_6, __pyx_t_2, __pyx_int_0, __pyx_t_7, __pyx_t_10, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3464, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_t_6, __pyx_t_2, __pyx_int_0, __pyx_t_7, __pyx_t_10, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3464, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_9, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_9, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_9, __pyx_t_4);
      __pyx_t_6 = 0;
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_t_10 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3464
 *         if inter_steps:
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,             # <<<<<<<<<<<<<<
 *                                                         Nf, inter_steps)
 *             xm = xm[::inter_steps]
 */
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3464, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
    __pyx_v_xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3466
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,
 *                                                         Nf, inter_steps)
 *             xm = xm[::inter_steps]             # <<<<<<<<<<<<<<
 *             xm = np.divide(xm, self.Omega)
 *         else:
 */
    __pyx_t_12.data = __pyx_v_xm.data;
    __pyx_t_12.memview = __pyx_v_xm.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_12, 0);
    __pyx_t_9 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_12,
    __pyx_v_xm.shape[0], __pyx_v_xm.strides[0], __pyx_v_xm.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    0,
    0,
    __pyx_v_inter_steps,
    0,
    0,
    1,
    1) < 0))
{
    __PYX_ERR(0, 3466, __pyx_L1_error)
}

__pyx_t_12.shape[1] = __pyx_v_xm.shape[1];
__pyx_t_12.strides[1] = __pyx_v_xm.strides[1];
    __pyx_t_12.suboffsets[1] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
    __pyx_v_xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3467
 *                                                         Nf, inter_steps)
 *             xm = xm[::inter_steps]
 *             xm = np.divide(xm, self.Omega)             # <<<<<<<<<<<<<<
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf, maxNumSteps=self.steps*Nf)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_divide); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_xm, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3467, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3467, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3467, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
    __pyx_v_xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3462
 *             double [:, :, :, :] full_cov
 *             double t, dt=time_points[1]
 *         if inter_steps:             # <<<<<<<<<<<<<<
 *             x0 = np.multiply(x0, self.Omega)
 *             xm = pyross.utils.forward_euler_integration(self._rhs0, x0, 0, Tf,
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3469
 *             xm = np.divide(xm, self.Omega)
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf, maxNumSteps=self.steps*Nf)             # <<<<<<<<<<<<<<
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_integrate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_Tf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_Nf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_self->steps * __pyx_v_Nf)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxNumSteps, __pyx_t_7) < 0) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3469, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
    __pyx_v_xm = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3470
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf, maxNumSteps=self.steps*Nf)
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 *         for i in range(Nf-1):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_Nf - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_8);
  __pyx_t_7 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 3470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_full_cov = __pyx_t_16;
  __pyx_t_16.memview = NULL;
  __pyx_t_16.data = NULL;

  /* "pyross/inference.pyx":3471
 *             xm = self.integrate(x0, 0, Tf, Nf, maxNumSteps=self.steps*Nf)
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         for i in range(Nf-1):
 *             t = time_points[i]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
  __pyx_t_1 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cov = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "pyross/inference.pyx":3472
 *         full_cov = np.zeros((Nf-1, dim, Nf-1, dim), dtype=DTYPE)
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 *         for i in range(Nf-1):             # <<<<<<<<<<<<<<
 *             t = time_points[i]
 *             xt = xm[i]
 */
  __pyx_t_11 = (__pyx_v_Nf - 1);
  __pyx_t_17 = __pyx_t_11;
  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
    __pyx_v_i = __pyx_t_18;

    /* "pyross/inference.pyx":3473
 *         cov = np.zeros((dim, dim), dtype=DTYPE)
 *         for i in range(Nf-1):
 *             t = time_points[i]             # <<<<<<<<<<<<<<
 *             xt = xm[i]
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=True, jacobian=True)
 */
    __pyx_t_19 = __pyx_v_i;
    __pyx_v_t = (*((double *) ( /* dim=0 */ (__pyx_v_time_points.data + __pyx_t_19 * __pyx_v_time_points.strides[0]) )));

    /* "pyross/inference.pyx":3474
 *         for i in range(Nf-1):
 *             t = time_points[i]
 *             xt = xm[i]             # <<<<<<<<<<<<<<
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=True, jacobian=True)
 *             cond_cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 */
    __pyx_t_13.data = __pyx_v_xm.data;
    __pyx_t_13.memview = __pyx_v_xm.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_13, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_xm.strides[0];
        if ((0)) __PYX_ERR(0, 3474, __pyx_L1_error)
        __pyx_t_13.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_13.shape[0] = __pyx_v_xm.shape[1];
__pyx_t_13.strides[0] = __pyx_v_xm.strides[1];
    __pyx_t_13.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_xt, 1);
    __pyx_v_xt = __pyx_t_13;
    __pyx_t_13.memview = NULL;
    __pyx_t_13.data = NULL;

    /* "pyross/inference.pyx":3475
 *             t = time_points[i]
 *             xt = xm[i]
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=True, jacobian=True)             # <<<<<<<<<<<<<<
 *             cond_cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 *             J_dt = np.multiply(dt, self.J_mat)
 */
    __pyx_t_20.__pyx_n = 2;
    __pyx_t_20.b_matrix = Py_True;
    __pyx_t_20.jacobian = Py_True;
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->compute_jacobian_and_b_matrix(__pyx_v_self, __pyx_v_xt, __pyx_v_t, &__pyx_t_20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":3476
 *             xt = xm[i]
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=True, jacobian=True)
 *             cond_cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))             # <<<<<<<<<<<<<<
 *             J_dt = np.multiply(dt, self.J_mat)
 *             U = np.add(np.identity(dim), J_dt)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_multiply); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->B_vec), PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 3476, __pyx_L1_error)
    __pyx_t_10 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->convert_vec_to_mat(__pyx_v_self, __pyx_t_13, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
    __pyx_t_13.memview = NULL;
    __pyx_t_13.data = NULL;
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3476, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3476, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_t_10);
      __pyx_t_4 = 0;
      __pyx_t_10 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3476, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_cond_cov, 1);
    __pyx_v_cond_cov = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3477
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=True, jacobian=True)
 *             cond_cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 *             J_dt = np.multiply(dt, self.J_mat)             # <<<<<<<<<<<<<<
 *             U = np.add(np.identity(dim), J_dt)
 *             cov = np.add(np.dot(np.dot(U, cov), U.T), cond_cov)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_multiply); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_8, ((PyObject *)__pyx_v_self->J_mat)};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3477, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_8, ((PyObject *)__pyx_v_self->J_mat)};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3477, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_t_8);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->J_mat));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->J_mat));
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, ((PyObject *)__pyx_v_self->J_mat));
      __pyx_t_8 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3477, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_J_dt, 1);
    __pyx_v_J_dt = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3478
 *             cond_cov = np.multiply(dt, self.convert_vec_to_mat(self.B_vec))
 *             J_dt = np.multiply(dt, self.J_mat)
 *             U = np.add(np.identity(dim), J_dt)             # <<<<<<<<<<<<<<
 *             cov = np.add(np.dot(np.dot(U, cov), U.T), cond_cov)
 *             full_cov[i, :, i, :] = cov
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_add); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_identity); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_J_dt, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3478, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3478, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_10);
      __pyx_t_7 = 0;
      __pyx_t_10 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3478, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_U, 1);
    __pyx_v_U = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3479
 *             J_dt = np.multiply(dt, self.J_mat)
 *             U = np.add(np.identity(dim), J_dt)
 *             cov = np.add(np.dot(np.dot(U, cov), U.T), cond_cov)             # <<<<<<<<<<<<<<
 *             full_cov[i, :, i, :] = cov
 *             if i>0:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_add); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_dot); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_U, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_cov, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_8, __pyx_t_6};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_8, __pyx_t_6};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_21 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_9, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_9, __pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_6 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_21, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __pyx_v_U;
    __PYX_INC_MEMVIEW(&__pyx_t_12, 1);
    if (unlikely(__pyx_memslice_transpose(&__pyx_t_12) == 0)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_12, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;
    __pyx_t_21 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_21)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_21);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_10, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_10, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_21) {
        __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_21); __pyx_t_21 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_2);
      __pyx_t_10 = 0;
      __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_cond_cov, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_7);
      __pyx_t_4 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
    __pyx_v_cov = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3480
 *             U = np.add(np.identity(dim), J_dt)
 *             cov = np.add(np.dot(np.dot(U, cov), U.T), cond_cov)
 *             full_cov[i, :, i, :] = cov             # <<<<<<<<<<<<<<
 *             if i>0:
 *                 for j in range(0, i):
 */
    __pyx_t_12.data = __pyx_v_full_cov.data;
    __pyx_t_12.memview = __pyx_v_full_cov.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_12, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3480, __pyx_L1_error)
        __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_12.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_12.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_12.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3480, __pyx_L1_error)
        __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_12.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_12.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_12.suboffsets[1] = -1;

if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_cov, __pyx_t_12, 2, 2, 0) < 0)) __PYX_ERR(0, 3480, __pyx_L1_error)
    __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3481
 *             cov = np.add(np.dot(np.dot(U, cov), U.T), cond_cov)
 *             full_cov[i, :, i, :] = cov
 *             if i>0:             # <<<<<<<<<<<<<<
 *                 for j in range(0, i):
 *                     temp = np.dot(full_cov[j, :, i-1, :], U.T)
 */
    __pyx_t_15 = ((__pyx_v_i > 0) != 0);
    if (__pyx_t_15) {

      /* "pyross/inference.pyx":3482
 *             full_cov[i, :, i, :] = cov
 *             if i>0:
 *                 for j in range(0, i):             # <<<<<<<<<<<<<<
 *                     temp = np.dot(full_cov[j, :, i-1, :], U.T)
 *                     full_cov[j, :, i, :] = temp
 */
      __pyx_t_22 = __pyx_v_i;
      __pyx_t_23 = __pyx_t_22;
      for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
        __pyx_v_j = __pyx_t_24;

        /* "pyross/inference.pyx":3483
 *             if i>0:
 *                 for j in range(0, i):
 *                     temp = np.dot(full_cov[j, :, i-1, :], U.T)             # <<<<<<<<<<<<<<
 *                     full_cov[j, :, i, :] = temp
 *                     full_cov[i, :, j, :] = temp.T
 */
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_25.data = __pyx_v_full_cov.data;
        __pyx_t_25.memview = __pyx_v_full_cov.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
        {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_25.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_25.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = (__pyx_v_i - 1);
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_25.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_25.suboffsets[1] = -1;

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;
        __pyx_t_25 = __pyx_v_U;
        __PYX_INC_MEMVIEW(&__pyx_t_25, 1);
        if (unlikely(__pyx_memslice_transpose(&__pyx_t_25) == 0)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;
        __pyx_t_4 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3483, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3483, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_7);
          __pyx_t_5 = 0;
          __pyx_t_7 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 3483, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1);
        __pyx_v_temp = __pyx_t_25;
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;

        /* "pyross/inference.pyx":3484
 *                 for j in range(0, i):
 *                     temp = np.dot(full_cov[j, :, i-1, :], U.T)
 *                     full_cov[j, :, i, :] = temp             # <<<<<<<<<<<<<<
 *                     full_cov[i, :, j, :] = temp.T
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim)) # returns mean and cov for all but first (fixed!) time point
 */
        __pyx_t_25.data = __pyx_v_full_cov.data;
        __pyx_t_25.memview = __pyx_v_full_cov.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
        {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3484, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_25.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_25.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3484, __pyx_L1_error)
        __pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_25.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_25.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_25.suboffsets[1] = -1;

if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_temp, __pyx_t_25, 2, 2, 0) < 0)) __PYX_ERR(0, 3484, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
        __pyx_t_25.memview = NULL;
        __pyx_t_25.data = NULL;

        /* "pyross/inference.pyx":3485
 *                     temp = np.dot(full_cov[j, :, i-1, :], U.T)
 *                     full_cov[j, :, i, :] = temp
 *                     full_cov[i, :, j, :] = temp.T             # <<<<<<<<<<<<<<
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim)) # returns mean and cov for all but first (fixed!) time point
 * 
 */
        __pyx_t_26 = __pyx_v_temp;
        __PYX_INC_MEMVIEW(&__pyx_t_26, 1);
        if (unlikely(__pyx_memslice_transpose(&__pyx_t_26) == 0)) __PYX_ERR(0, 3485, __pyx_L1_error)
        __pyx_t_27.data = __pyx_v_full_cov.data;
        __pyx_t_27.memview = __pyx_v_full_cov.memview;
        __PYX_INC_MEMVIEW(&__pyx_t_27, 0);
        {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_i;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[0];
        if ((0)) __PYX_ERR(0, 3485, __pyx_L1_error)
        __pyx_t_27.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_27.shape[0] = __pyx_v_full_cov.shape[1];
__pyx_t_27.strides[0] = __pyx_v_full_cov.strides[1];
    __pyx_t_27.suboffsets[0] = -1;

{
    Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_full_cov.strides[2];
        if ((0)) __PYX_ERR(0, 3485, __pyx_L1_error)
        __pyx_t_27.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_27.shape[1] = __pyx_v_full_cov.shape[3];
__pyx_t_27.strides[1] = __pyx_v_full_cov.strides[3];
    __pyx_t_27.suboffsets[1] = -1;

if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_26, __pyx_t_27, 2, 2, 0) < 0)) __PYX_ERR(0, 3485, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_27, 1);
        __pyx_t_27.memview = NULL;
        __pyx_t_27.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
        __pyx_t_26.memview = NULL;
        __pyx_t_26.data = NULL;
      }

      /* "pyross/inference.pyx":3481
 *             cov = np.add(np.dot(np.dot(U, cov), U.T), cond_cov)
 *             full_cov[i, :, i, :] = cov
 *             if i>0:             # <<<<<<<<<<<<<<
 *                 for j in range(0, i):
 *                     temp = np.dot(full_cov[j, :, i-1, :], U.T)
 */
    }
  }

  /* "pyross/inference.pyx":3486
 *                     full_cov[j, :, i, :] = temp
 *                     full_cov[i, :, j, :] = temp.T
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim)) # returns mean and cov for all but first (fixed!) time point             # <<<<<<<<<<<<<<
 * 
 *     cpdef _rhs0(self, t, xt):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_26.data = __pyx_v_xm.data;
  __pyx_t_26.memview = __pyx_v_xm.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_26, 0);
  __pyx_t_9 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_26,
    __pyx_v_xm.shape[0], __pyx_v_xm.strides[0], __pyx_v_xm.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    1,
    0,
    0,
    1,
    0,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3486, __pyx_L1_error)
}

__pyx_t_26.shape[1] = __pyx_v_xm.shape[1];
__pyx_t_26.strides[1] = __pyx_v_xm.strides[1];
    __pyx_t_26.suboffsets[1] = -1;

__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_26, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
  __pyx_t_26.memview = NULL;
  __pyx_t_26.data = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_reshape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_full_cov, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyInt_FromSsize_t(((__pyx_v_Nf - 1) * __pyx_v_dim)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyInt_FromSsize_t(((__pyx_v_Nf - 1) * __pyx_v_dim)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_6, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3486, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_6, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3486, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_10);
    __pyx_t_6 = 0;
    __pyx_t_10 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3453
 *         return np.asarray(ip).T
 * 
 *     cpdef obtain_full_mean_cov_tangent_space(self, double [:] x0, double Tf, Py_ssize_t Nf, Py_ssize_t inter_steps=0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t dim=self.dim, i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
  __Pyx_XDECREF(__pyx_t_21);
  __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_27, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_full_mean_cov_tangent_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_xm, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_time_points, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xt, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_cond_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_U, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_J_dt, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_full_cov, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_135obtain_full_mean_cov_tangent_space(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_135obtain_full_mean_cov_tangent_space(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_x0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_Tf;
  Py_ssize_t __pyx_v_Nf;
  Py_ssize_t __pyx_v_inter_steps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("obtain_full_mean_cov_tangent_space (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x0,&__pyx_n_s_Tf,&__pyx_n_s_Nf,&__pyx_n_s_inter_steps,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Tf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_full_mean_cov_tangent_space", 0, 3, 4, 1); __PYX_ERR(0, 3453, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Nf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("obtain_full_mean_cov_tangent_space", 0, 3, 4, 2); __PYX_ERR(0, 3453, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inter_steps);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "obtain_full_mean_cov_tangent_space") < 0)) __PYX_ERR(0, 3453, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x0 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x0.memview)) __PYX_ERR(0, 3453, __pyx_L3_error)
    __pyx_v_Tf = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_Tf == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3453, __pyx_L3_error)
    __pyx_v_Nf = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_Nf == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3453, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_inter_steps = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_inter_steps == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3453, __pyx_L3_error)
    } else {
      __pyx_v_inter_steps = ((Py_ssize_t)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("obtain_full_mean_cov_tangent_space", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_full_mean_cov_tangent_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_134obtain_full_mean_cov_tangent_space(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, __pyx_v_inter_steps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_134obtain_full_mean_cov_tangent_space(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_Tf, Py_ssize_t __pyx_v_Nf, Py_ssize_t __pyx_v_inter_steps) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space __pyx_t_2;
  __Pyx_RefNannySetupContext("obtain_full_mean_cov_tangent_space", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_x0.memview)) { __Pyx_RaiseUnboundLocalError("x0"); __PYX_ERR(0, 3453, __pyx_L1_error) }
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.inter_steps = __pyx_v_inter_steps;
  __pyx_t_1 = __pyx_vtabptr_6pyross_9inference_SIR_type->obtain_full_mean_cov_tangent_space(__pyx_v_self, __pyx_v_x0, __pyx_v_Tf, __pyx_v_Nf, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.obtain_full_mean_cov_tangent_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3488
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim)) # returns mean and cov for all but first (fixed!) time point
 * 
 *     cpdef _rhs0(self, t, xt):             # <<<<<<<<<<<<<<
 *         self.det_model.set_contactMatrix(t, self.contactMatrix)
 *         self.det_model.rhs(xt, t)
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_137_rhs0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type__rhs0(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_xt, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_rhs0", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rhs0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_137_rhs0)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_t, __pyx_v_xt};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3488, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_t, __pyx_v_xt};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3488, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_t);
          __Pyx_GIVEREF(__pyx_v_t);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_t);
          __Pyx_INCREF(__pyx_v_xt);
          __Pyx_GIVEREF(__pyx_v_xt);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_xt);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3489
 * 
 *     cpdef _rhs0(self, t, xt):
 *         self.det_model.set_contactMatrix(t, self.contactMatrix)             # <<<<<<<<<<<<<<
 *         self.det_model.rhs(xt, t)
 *         return self.det_model.dxdt
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_contactMatrix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_t, __pyx_v_self->contactMatrix};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_t, __pyx_v_self->contactMatrix};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_t);
    __Pyx_GIVEREF(__pyx_v_t);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_t);
    __Pyx_INCREF(__pyx_v_self->contactMatrix);
    __Pyx_GIVEREF(__pyx_v_self->contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_self->contactMatrix);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3490
 *     cpdef _rhs0(self, t, xt):
 *         self.det_model.set_contactMatrix(t, self.contactMatrix)
 *         self.det_model.rhs(xt, t)             # <<<<<<<<<<<<<<
 *         return self.det_model.dxdt
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rhs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_xt, __pyx_v_t};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_xt, __pyx_v_t};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_xt);
    __Pyx_GIVEREF(__pyx_v_xt);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_v_xt);
    __Pyx_INCREF(__pyx_v_t);
    __Pyx_GIVEREF(__pyx_v_t);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_t);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3491
 *         self.det_model.set_contactMatrix(t, self.contactMatrix)
 *         self.det_model.rhs(xt, t)
 *         return self.det_model.dxdt             # <<<<<<<<<<<<<<
 * 
 *     cpdef _obtain_time_evol_op_2(self, sol, double t1, double t2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3488
 *         return xm[1:], np.reshape(full_cov, ((Nf-1)*dim, (Nf-1)*dim)) # returns mean and cov for all but first (fixed!) time point
 * 
 *     cpdef _rhs0(self, t, xt):             # <<<<<<<<<<<<<<
 *         self.det_model.set_contactMatrix(t, self.contactMatrix)
 *         self.det_model.rhs(xt, t)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyross.inference.SIR_type._rhs0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_137_rhs0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_137_rhs0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_xt = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_rhs0 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_xt,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_rhs0", 1, 2, 2, 1); __PYX_ERR(0, 3488, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rhs0") < 0)) __PYX_ERR(0, 3488, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_t = values[0];
    __pyx_v_xt = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_rhs0", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3488, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._rhs0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_136_rhs0(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_t, __pyx_v_xt);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_136_rhs0(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_xt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_rhs0", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pyross_9inference_8SIR_type__rhs0(__pyx_v_self, __pyx_v_t, __pyx_v_xt, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._rhs0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3493
 *         return self.det_model.dxdt
 * 
 *     cpdef _obtain_time_evol_op_2(self, sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] U=self.U
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_139_obtain_time_evol_op_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type__obtain_time_evol_op_2(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2, int __pyx_skip_dispatch) {
  __Pyx_memviewslice __pyx_v_U = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xi = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xf = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_epsilon;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_steps;
  PyObject *__pyx_v_pos = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  double __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __Pyx_RefNannySetupContext("_obtain_time_evol_op_2", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_obtain_time_evol_op_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_139_obtain_time_evol_op_2)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3493, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3493, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_sol, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3493, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_sol, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3493, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_v_sol);
          __Pyx_GIVEREF(__pyx_v_sol);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_sol);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3495
 *     cpdef _obtain_time_evol_op_2(self, sol, double t1, double t2):
 *         cdef:
 *             double [:, :] U=self.U             # <<<<<<<<<<<<<<
 *             double [:] xi, xf
 *             double epsilon=1./self.Omega
 */
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->U), PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 3495, __pyx_L1_error)
  __pyx_v_U = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;

  /* "pyross/inference.pyx":3497
 *             double [:, :] U=self.U
 *             double [:] xi, xf
 *             double epsilon=1./self.Omega             # <<<<<<<<<<<<<<
 *             Py_ssize_t i, j, steps=self.steps
 *         if isclose(t1, t2):
 */
  __pyx_v_epsilon = (1. / __pyx_v_self->Omega);

  /* "pyross/inference.pyx":3498
 *             double [:] xi, xf
 *             double epsilon=1./self.Omega
 *             Py_ssize_t i, j, steps=self.steps             # <<<<<<<<<<<<<<
 *         if isclose(t1, t2):
 *             U = np.eye(self.dim)
 */
  __pyx_t_10 = __pyx_v_self->steps;
  __pyx_v_steps = __pyx_t_10;

  /* "pyross/inference.pyx":3499
 *             double epsilon=1./self.Omega
 *             Py_ssize_t i, j, steps=self.steps
 *         if isclose(t1, t2):             # <<<<<<<<<<<<<<
 *             U = np.eye(self.dim)
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_isclose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3499, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3499, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_11) {

    /* "pyross/inference.pyx":3500
 *             Py_ssize_t i, j, steps=self.steps
 *         if isclose(t1, t2):
 *             U = np.eye(self.dim)             # <<<<<<<<<<<<<<
 *         else:
 *             xi = sol(t1)/self.Omega
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_eye); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 3500, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_U, 1);
    __pyx_v_U = __pyx_t_9;
    __pyx_t_9.memview = NULL;
    __pyx_t_9.data = NULL;

    /* "pyross/inference.pyx":3499
 *             double epsilon=1./self.Omega
 *             Py_ssize_t i, j, steps=self.steps
 *         if isclose(t1, t2):             # <<<<<<<<<<<<<<
 *             U = np.eye(self.dim)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3502
 *             U = np.eye(self.dim)
 *         else:
 *             xi = sol(t1)/self.Omega             # <<<<<<<<<<<<<<
 *             xf = sol(t2)/self.Omega
 *             for i in range(self.dim):
 */
  /*else*/ {
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_sol);
    __pyx_t_2 = __pyx_v_sol; __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3502, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_xi = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3503
 *         else:
 *             xi = sol(t1)/self.Omega
 *             xf = sol(t2)/self.Omega             # <<<<<<<<<<<<<<
 *             for i in range(self.dim):
 *                 xi[i] += epsilon
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_sol);
    __pyx_t_1 = __pyx_v_sol; __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 3503, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_xf = __pyx_t_12;
    __pyx_t_12.memview = NULL;
    __pyx_t_12.data = NULL;

    /* "pyross/inference.pyx":3504
 *             xi = sol(t1)/self.Omega
 *             xf = sol(t2)/self.Omega
 *             for i in range(self.dim):             # <<<<<<<<<<<<<<
 *                 xi[i] += epsilon
 *                 pos = self.integrate(xi, t1, t2, steps)[steps-1]
 */
    __pyx_t_10 = __pyx_v_self->dim;
    __pyx_t_13 = __pyx_t_10;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_i = __pyx_t_14;

      /* "pyross/inference.pyx":3505
 *             xf = sol(t2)/self.Omega
 *             for i in range(self.dim):
 *                 xi[i] += epsilon             # <<<<<<<<<<<<<<
 *                 pos = self.integrate(xi, t1, t2, steps)[steps-1]
 *                 for j in range(self.dim):
 */
      __pyx_t_15 = __pyx_v_i;
      *((double *) ( /* dim=0 */ (__pyx_v_xi.data + __pyx_t_15 * __pyx_v_xi.strides[0]) )) += __pyx_v_epsilon;

      /* "pyross/inference.pyx":3506
 *             for i in range(self.dim):
 *                 xi[i] += epsilon
 *                 pos = self.integrate(xi, t1, t2, steps)[steps-1]             # <<<<<<<<<<<<<<
 *                 for j in range(self.dim):
 *                     U[j, i] = (pos[j]-xf[j])/(epsilon)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_integrate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xi, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_3, __pyx_t_8, __pyx_t_5, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3506, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_3, __pyx_t_8, __pyx_t_5, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3506, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_16 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3506, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_7, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_7, __pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_8 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3506, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = (__pyx_v_steps - 1);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_17, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyross/inference.pyx":3507
 *                 xi[i] += epsilon
 *                 pos = self.integrate(xi, t1, t2, steps)[steps-1]
 *                 for j in range(self.dim):             # <<<<<<<<<<<<<<
 *                     U[j, i] = (pos[j]-xf[j])/(epsilon)
 *                 xi[i] -= epsilon
 */
      __pyx_t_17 = __pyx_v_self->dim;
      __pyx_t_18 = __pyx_t_17;
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
        __pyx_v_j = __pyx_t_19;

        /* "pyross/inference.pyx":3508
 *                 pos = self.integrate(xi, t1, t2, steps)[steps-1]
 *                 for j in range(self.dim):
 *                     U[j, i] = (pos[j]-xf[j])/(epsilon)             # <<<<<<<<<<<<<<
 *                 xi[i] -= epsilon
 * 
 */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pos, __pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_20 = __pyx_v_j;
        __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_xf.data + __pyx_t_20 * __pyx_v_xf.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_16 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3508, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_22 = __pyx_v_j;
        __pyx_t_23 = __pyx_v_i;
        *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_U.data + __pyx_t_22 * __pyx_v_U.strides[0]) ) + __pyx_t_23 * __pyx_v_U.strides[1]) )) = __pyx_t_21;
      }

      /* "pyross/inference.pyx":3509
 *                 for j in range(self.dim):
 *                     U[j, i] = (pos[j]-xf[j])/(epsilon)
 *                 xi[i] -= epsilon             # <<<<<<<<<<<<<<
 * 
 *     def _obtain_time_evol_op(self, sol, double t1, double t2):
 */
      __pyx_t_24 = __pyx_v_i;
      *((double *) ( /* dim=0 */ (__pyx_v_xi.data + __pyx_t_24 * __pyx_v_xi.strides[0]) )) -= __pyx_v_epsilon;
    }
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3493
 *         return self.det_model.dxdt
 * 
 *     cpdef _obtain_time_evol_op_2(self, sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] U=self.U
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_U, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_xf, 1);
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_139_obtain_time_evol_op_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_139_obtain_time_evol_op_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sol = 0;
  double __pyx_v_t1;
  double __pyx_v_t2;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_obtain_time_evol_op_2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sol,&__pyx_n_s_t1,&__pyx_n_s_t2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_obtain_time_evol_op_2", 1, 3, 3, 1); __PYX_ERR(0, 3493, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_obtain_time_evol_op_2", 1, 3, 3, 2); __PYX_ERR(0, 3493, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_obtain_time_evol_op_2") < 0)) __PYX_ERR(0, 3493, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_sol = values[0];
    __pyx_v_t1 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3493, __pyx_L3_error)
    __pyx_v_t2 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_t2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3493, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_obtain_time_evol_op_2", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3493, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_138_obtain_time_evol_op_2(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sol, __pyx_v_t1, __pyx_v_t2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_138_obtain_time_evol_op_2(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_obtain_time_evol_op_2", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pyross_9inference_8SIR_type__obtain_time_evol_op_2(__pyx_v_self, __pyx_v_sol, __pyx_v_t1, __pyx_v_t2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3511
 *                 xi[i] -= epsilon
 * 
 *     def _obtain_time_evol_op(self, sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t steps=self.steps
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_141_obtain_time_evol_op(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_141_obtain_time_evol_op(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sol = 0;
  double __pyx_v_t1;
  double __pyx_v_t2;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_obtain_time_evol_op (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sol,&__pyx_n_s_t1,&__pyx_n_s_t2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_obtain_time_evol_op", 1, 3, 3, 1); __PYX_ERR(0, 3511, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_obtain_time_evol_op", 1, 3, 3, 2); __PYX_ERR(0, 3511, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_obtain_time_evol_op") < 0)) __PYX_ERR(0, 3511, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_sol = values[0];
    __pyx_v_t1 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3511, __pyx_L3_error)
    __pyx_v_t2 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_t2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3511, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_obtain_time_evol_op", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3511, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_140_obtain_time_evol_op(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_sol, __pyx_v_t1, __pyx_v_t2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3515
 *             Py_ssize_t steps=self.steps
 * 
 *         def rhs(t, U_vec):             # <<<<<<<<<<<<<<
 *             xt = sol(t)/self.Omega
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_1rhs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_1rhs = {"rhs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_1rhs, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_1rhs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_U_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rhs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_U_vec,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_U_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rhs", 1, 2, 2, 1); __PYX_ERR(0, 3515, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rhs") < 0)) __PYX_ERR(0, 3515, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_t = values[0];
    __pyx_v_U_vec = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rhs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3515, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op.rhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_rhs(__pyx_self, __pyx_v_t, __pyx_v_U_vec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_rhs(PyObject *__pyx_self, PyObject *__pyx_v_t, PyObject *__pyx_v_U_vec) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *__pyx_outer_scope;
  PyObject *__pyx_v_xt = NULL;
  PyObject *__pyx_v_U_mat = NULL;
  PyObject *__pyx_v_dUdt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_5;
  struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("rhs", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":3516
 * 
 *         def rhs(t, U_vec):
 *             xt = sol(t)/self.Omega             # <<<<<<<<<<<<<<
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 *             U_mat = np.reshape(U_vec, (self.dim, self.dim))
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_sol)) { __Pyx_RaiseClosureNameError("sol"); __PYX_ERR(0, 3516, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sol);
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_sol; __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3516, __pyx_L1_error) }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_xt = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3517
 *         def rhs(t, U_vec):
 *             xt = sol(t)/self.Omega
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)             # <<<<<<<<<<<<<<
 *             U_mat = np.reshape(U_vec, (self.dim, self.dim))
 *             dUdt = np.dot(self.J_mat, U_mat)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3517, __pyx_L1_error) }
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_xt, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3517, __pyx_L1_error)
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3517, __pyx_L1_error)
  __pyx_t_6.__pyx_n = 2;
  __pyx_t_6.b_matrix = Py_False;
  __pyx_t_6.jacobian = Py_True;
  __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->compute_jacobian_and_b_matrix(__pyx_cur_scope->__pyx_v_self, __pyx_t_4, __pyx_t_5, &__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3518
 *             xt = sol(t)/self.Omega
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 *             U_mat = np.reshape(U_vec, (self.dim, self.dim))             # <<<<<<<<<<<<<<
 *             dUdt = np.dot(self.J_mat, U_mat)
 *             return np.ravel(dUdt)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reshape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3518, __pyx_L1_error) }
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3518, __pyx_L1_error) }
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
  __pyx_t_2 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_U_vec, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3518, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_U_vec, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3518, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_U_vec);
    __Pyx_GIVEREF(__pyx_v_U_vec);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_U_vec);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_U_mat = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3519
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 *             U_mat = np.reshape(U_vec, (self.dim, self.dim))
 *             dUdt = np.dot(self.J_mat, U_mat)             # <<<<<<<<<<<<<<
 *             return np.ravel(dUdt)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3519, __pyx_L1_error) }
  __pyx_t_1 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_cur_scope->__pyx_v_self->J_mat), __pyx_v_U_mat};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_cur_scope->__pyx_v_self->J_mat), __pyx_v_U_mat};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->J_mat));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->J_mat));
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, ((PyObject *)__pyx_cur_scope->__pyx_v_self->J_mat));
    __Pyx_INCREF(__pyx_v_U_mat);
    __Pyx_GIVEREF(__pyx_v_U_mat);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_v_U_mat);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dUdt = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3520
 *             U_mat = np.reshape(U_vec, (self.dim, self.dim))
 *             dUdt = np.dot(self.J_mat, U_mat)
 *             return np.ravel(dUdt)             # <<<<<<<<<<<<<<
 * 
 *         if isclose(t1, t2): ## float precision
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ravel); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_v_dUdt) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_dUdt);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3515
 *             Py_ssize_t steps=self.steps
 * 
 *         def rhs(t, U_vec):             # <<<<<<<<<<<<<<
 *             xt = sol(t)/self.Omega
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op.rhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xt);
  __Pyx_XDECREF(__pyx_v_U_mat);
  __Pyx_XDECREF(__pyx_v_dUdt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3511
 *                 xi[i] -= epsilon
 * 
 *     def _obtain_time_evol_op(self, sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t steps=self.steps
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_140_obtain_time_evol_op(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_sol, double __pyx_v_t1, double __pyx_v_t2) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *__pyx_cur_scope;
  Py_ssize_t __pyx_v_steps;
  PyObject *__pyx_v_rhs = 0;
  PyObject *__pyx_v_U0 = NULL;
  PyObject *__pyx_v_U_vec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_obtain_time_evol_op", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op(__pyx_ptype_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3511, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_sol = __pyx_v_sol;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sol);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sol);

  /* "pyross/inference.pyx":3513
 *     def _obtain_time_evol_op(self, sol, double t1, double t2):
 *         cdef:
 *             Py_ssize_t steps=self.steps             # <<<<<<<<<<<<<<
 * 
 *         def rhs(t, U_vec):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->steps;
  __pyx_v_steps = __pyx_t_1;

  /* "pyross/inference.pyx":3515
 *             Py_ssize_t steps=self.steps
 * 
 *         def rhs(t, U_vec):             # <<<<<<<<<<<<<<
 *             xt = sol(t)/self.Omega
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_20_obtain_time_evol_op_1rhs, 0, __pyx_n_s_obtain_time_evol_op_locals_rhs, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rhs = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3522
 *             return np.ravel(dUdt)
 * 
 *         if isclose(t1, t2): ## float precision             # <<<<<<<<<<<<<<
 *             self.U = np.eye(self.dim)
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 3522, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":3523
 * 
 *         if isclose(t1, t2): ## float precision
 *             self.U = np.eye(self.dim)             # <<<<<<<<<<<<<<
 *         else:
 *             U0 = np.identity((self.dim)).flatten()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_eye); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3523, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->U);
    __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->U));
    __pyx_cur_scope->__pyx_v_self->U = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":3522
 *             return np.ravel(dUdt)
 * 
 *         if isclose(t1, t2): ## float precision             # <<<<<<<<<<<<<<
 *             self.U = np.eye(self.dim)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3525
 *             self.U = np.eye(self.dim)
 *         else:
 *             U0 = np.identity((self.dim)).flatten()             # <<<<<<<<<<<<<<
 *             U_vec = self._solve_lyapunov_type_eq(rhs, U0, t1, t2, steps)
 *             self.U = np.reshape(U_vec, (self.dim, self.dim))
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_identity); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flatten); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_U0 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":3526
 *         else:
 *             U0 = np.identity((self.dim)).flatten()
 *             U_vec = self._solve_lyapunov_type_eq(rhs, U0, t1, t2, steps)             # <<<<<<<<<<<<<<
 *             self.U = np.reshape(U_vec, (self.dim, self.dim))
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_solve_lyapunov_type_eq); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_rhs, __pyx_v_U0, __pyx_t_8, __pyx_t_3, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3526, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_rhs, __pyx_v_U0, __pyx_t_8, __pyx_t_3, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3526, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3526, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_rhs);
      __Pyx_GIVEREF(__pyx_v_rhs);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_v_rhs);
      __Pyx_INCREF(__pyx_v_U0);
      __Pyx_GIVEREF(__pyx_v_U0);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_v_U0);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_7, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_7, __pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3526, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_U_vec = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":3527
 *             U0 = np.identity((self.dim)).flatten()
 *             U_vec = self._solve_lyapunov_type_eq(rhs, U0, t1, t2, steps)
 *             self.U = np.reshape(U_vec, (self.dim, self.dim))             # <<<<<<<<<<<<<<
 * 
 *     def _solve_lyapunov_type_eq(self, rhs, M0, t1, t2, steps):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_reshape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_self->dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_U_vec, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_U_vec, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_U_vec);
      __Pyx_GIVEREF(__pyx_v_U_vec);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_U_vec);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->U);
    __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->U));
    __pyx_cur_scope->__pyx_v_self->U = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3511
 *                 xi[i] -= epsilon
 * 
 *     def _obtain_time_evol_op(self, sol, double t1, double t2):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t steps=self.steps
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type._obtain_time_evol_op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhs);
  __Pyx_XDECREF(__pyx_v_U0);
  __Pyx_XDECREF(__pyx_v_U_vec);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3529
 *             self.U = np.reshape(U_vec, (self.dim, self.dim))
 * 
 *     def _solve_lyapunov_type_eq(self, rhs, M0, t1, t2, steps):             # <<<<<<<<<<<<<<
 *         if self.lyapunov_method=='euler':
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_143_solve_lyapunov_type_eq(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_143_solve_lyapunov_type_eq(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rhs = 0;
  PyObject *__pyx_v_M0 = 0;
  PyObject *__pyx_v_t1 = 0;
  PyObject *__pyx_v_t2 = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_solve_lyapunov_type_eq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rhs,&__pyx_n_s_M0,&__pyx_n_s_t1,&__pyx_n_s_t2,&__pyx_n_s_steps,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_solve_lyapunov_type_eq", 1, 5, 5, 1); __PYX_ERR(0, 3529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_solve_lyapunov_type_eq", 1, 5, 5, 2); __PYX_ERR(0, 3529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_solve_lyapunov_type_eq", 1, 5, 5, 3); __PYX_ERR(0, 3529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_solve_lyapunov_type_eq", 1, 5, 5, 4); __PYX_ERR(0, 3529, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_solve_lyapunov_type_eq") < 0)) __PYX_ERR(0, 3529, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_rhs = values[0];
    __pyx_v_M0 = values[1];
    __pyx_v_t1 = values[2];
    __pyx_v_t2 = values[3];
    __pyx_v_steps = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_solve_lyapunov_type_eq", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3529, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._solve_lyapunov_type_eq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_142_solve_lyapunov_type_eq(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_rhs, __pyx_v_M0, __pyx_v_t1, __pyx_v_t2, __pyx_v_steps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_142_solve_lyapunov_type_eq(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_rhs, PyObject *__pyx_v_M0, PyObject *__pyx_v_t1, PyObject *__pyx_v_t2, PyObject *__pyx_v_steps) {
  PyObject *__pyx_v_sol_vec = NULL;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_solve_lyapunov_type_eq", 0);

  /* "pyross/inference.pyx":3530
 * 
 *     def _solve_lyapunov_type_eq(self, rhs, M0, t1, t2, steps):
 *         if self.lyapunov_method=='euler':             # <<<<<<<<<<<<<<
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         elif self.lyapunov_method=='RK45':
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->lyapunov_method, __pyx_n_u_euler, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":3531
 *     def _solve_lyapunov_type_eq(self, rhs, M0, t1, t2, steps):
 *         if self.lyapunov_method=='euler':
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]             # <<<<<<<<<<<<<<
 *         elif self.lyapunov_method=='RK45':
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyross); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_forward_euler_integration); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_rhs, __pyx_v_M0, __pyx_v_t1, __pyx_v_t2, __pyx_v_steps};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_rhs, __pyx_v_M0, __pyx_v_t1, __pyx_v_t2, __pyx_v_steps};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_rhs);
      __Pyx_GIVEREF(__pyx_v_rhs);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_rhs);
      __Pyx_INCREF(__pyx_v_M0);
      __Pyx_GIVEREF(__pyx_v_M0);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_M0);
      __Pyx_INCREF(__pyx_v_t1);
      __Pyx_GIVEREF(__pyx_v_t1);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_t1);
      __Pyx_INCREF(__pyx_v_t2);
      __Pyx_GIVEREF(__pyx_v_t2);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_t2);
      __Pyx_INCREF(__pyx_v_steps);
      __Pyx_GIVEREF(__pyx_v_steps);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_6, __pyx_v_steps);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_steps, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_sol_vec = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3530
 * 
 *     def _solve_lyapunov_type_eq(self, rhs, M0, t1, t2, steps):
 *         if self.lyapunov_method=='euler':             # <<<<<<<<<<<<<<
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         elif self.lyapunov_method=='RK45':
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3532
 *         if self.lyapunov_method=='euler':
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         elif self.lyapunov_method=='RK45':             # <<<<<<<<<<<<<<
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->lyapunov_method, __pyx_n_u_RK45, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3532, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":3533
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         elif self.lyapunov_method=='RK45':
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)             # <<<<<<<<<<<<<<
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='LSODA':
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_solve_ivp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_t1);
    __Pyx_GIVEREF(__pyx_v_t1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_t1);
    __Pyx_INCREF(__pyx_v_t2);
    __Pyx_GIVEREF(__pyx_v_t2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_t2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_rhs);
    __Pyx_GIVEREF(__pyx_v_rhs);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rhs);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_M0);
    __Pyx_GIVEREF(__pyx_v_M0);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_M0);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_method, __pyx_n_u_RK45) < 0) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_t2);
    __Pyx_GIVEREF(__pyx_v_t2);
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_t2);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_t_eval, __pyx_t_5) < 0) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_steps); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_first_step, __pyx_t_9) < 0) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_v_steps); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_max_step, __pyx_t_5) < 0) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->rtol_lyapunov); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_rtol, __pyx_t_5) < 0) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_res = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3534
 *         elif self.lyapunov_method=='RK45':
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]             # <<<<<<<<<<<<<<
 *         elif self.lyapunov_method=='LSODA':
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_tuple__2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_sol_vec = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":3532
 *         if self.lyapunov_method=='euler':
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         elif self.lyapunov_method=='RK45':             # <<<<<<<<<<<<<<
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3535
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='LSODA':             # <<<<<<<<<<<<<<
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->lyapunov_method, __pyx_n_u_LSODA, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3535, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":3536
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='LSODA':
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)             # <<<<<<<<<<<<<<
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='RK2':
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_solve_ivp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_t1);
    __Pyx_GIVEREF(__pyx_v_t1);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_t1);
    __Pyx_INCREF(__pyx_v_t2);
    __Pyx_GIVEREF(__pyx_v_t2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_t2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_rhs);
    __Pyx_GIVEREF(__pyx_v_rhs);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rhs);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_M0);
    __Pyx_GIVEREF(__pyx_v_M0);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_M0);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_method, __pyx_n_u_LSODA) < 0) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_t2);
    __Pyx_GIVEREF(__pyx_v_t2);
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_t2);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_t_eval, __pyx_t_7) < 0) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_first_step, __pyx_t_8) < 0) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_v_steps); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_max_step, __pyx_t_7) < 0) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_rtol, __pyx_t_7) < 0) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_res = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3537
 *         elif self.lyapunov_method=='LSODA':
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]             # <<<<<<<<<<<<<<
 *         elif self.lyapunov_method=='RK2':
 *             sol_vec = pyross.utils.RK2_integration(rhs, M0, t1, t2, steps)[steps-1]
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_y); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_tuple__2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_sol_vec = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":3535
 *             res = solve_ivp(rhs, (t1, t2), M0, method='RK45', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='LSODA':             # <<<<<<<<<<<<<<
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3538
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='RK2':             # <<<<<<<<<<<<<<
 *             sol_vec = pyross.utils.RK2_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         else:
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->lyapunov_method, __pyx_n_u_RK2, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3538, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_1)) {

    /* "pyross/inference.pyx":3539
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='RK2':
 *             sol_vec = pyross.utils.RK2_integration(rhs, M0, t1, t2, steps)[steps-1]             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Error: lyapunov method not found. Use set_lyapunov_method to change the method")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyross); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_RK2_integration); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_rhs, __pyx_v_M0, __pyx_v_t1, __pyx_v_t2, __pyx_v_steps};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3539, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_rhs, __pyx_v_M0, __pyx_v_t1, __pyx_v_t2, __pyx_v_steps};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3539, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_rhs);
      __Pyx_GIVEREF(__pyx_v_rhs);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_rhs);
      __Pyx_INCREF(__pyx_v_M0);
      __Pyx_GIVEREF(__pyx_v_M0);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_M0);
      __Pyx_INCREF(__pyx_v_t1);
      __Pyx_GIVEREF(__pyx_v_t1);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_t1);
      __Pyx_INCREF(__pyx_v_t2);
      __Pyx_GIVEREF(__pyx_v_t2);
      PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, __pyx_v_t2);
      __Pyx_INCREF(__pyx_v_steps);
      __Pyx_GIVEREF(__pyx_v_steps);
      PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_6, __pyx_v_steps);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_steps, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_sol_vec = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":3538
 *             res = solve_ivp(rhs, (t1, t2), M0, method='LSODA', t_eval=np.array([t2]), first_step=(t2-t1)/steps, max_step=(t2-t1)/steps, rtol=self.rtol_lyapunov)
 *             sol_vec = res.y[:, 0]
 *         elif self.lyapunov_method=='RK2':             # <<<<<<<<<<<<<<
 *             sol_vec = pyross.utils.RK2_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":3541
 *             sol_vec = pyross.utils.RK2_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         else:
 *             raise Exception("Error: lyapunov method not found. Use set_lyapunov_method to change the method")             # <<<<<<<<<<<<<<
 *         return sol_vec
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 3541, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":3542
 *         else:
 *             raise Exception("Error: lyapunov method not found. Use set_lyapunov_method to change the method")
 *         return sol_vec             # <<<<<<<<<<<<<<
 * 
 *     cdef _compute_dsigdt(self, double [:] sig):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sol_vec);
  __pyx_r = __pyx_v_sol_vec;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3529
 *             self.U = np.reshape(U_vec, (self.dim, self.dim))
 * 
 *     def _solve_lyapunov_type_eq(self, rhs, M0, t1, t2, steps):             # <<<<<<<<<<<<<<
 *         if self.lyapunov_method=='euler':
 *             sol_vec = pyross.utils.forward_euler_integration(rhs, M0, t1, t2, steps)[steps-1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type._solve_lyapunov_type_eq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sol_vec);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3544
 *         return sol_vec
 * 
 *     cdef _compute_dsigdt(self, double [:] sig):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, j
 */

static PyObject *__pyx_f_6pyross_9inference_8SIR_type__compute_dsigdt(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_sig) {
  Py_ssize_t __pyx_v_i;
  __Pyx_memviewslice __pyx_v_dsigdt = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_B_vec = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_linear_term_vec = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_sigma_mat = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_linear_term = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_linear_term;
  __Pyx_Buffer __pyx_pybuffer_linear_term;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  __Pyx_RefNannySetupContext("_compute_dsigdt", 0);
  __pyx_pybuffer_linear_term.pybuffer.buf = NULL;
  __pyx_pybuffer_linear_term.refcount = 0;
  __pyx_pybuffernd_linear_term.data = NULL;
  __pyx_pybuffernd_linear_term.rcbuffer = &__pyx_pybuffer_linear_term;

  /* "pyross/inference.pyx":3547
 *         cdef:
 *             Py_ssize_t i, j
 *             double [:] dsigdt=self.dsigmadt, B_vec=self.B_vec, linear_term_vec             # <<<<<<<<<<<<<<
 *             double [:, :] sigma_mat
 *             np.ndarray[DTYPE_t, ndim=2] linear_term
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->dsigmadt), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3547, __pyx_L1_error)
  __pyx_v_dsigdt = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->B_vec), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3547, __pyx_L1_error)
  __pyx_v_B_vec = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3550
 *             double [:, :] sigma_mat
 *             np.ndarray[DTYPE_t, ndim=2] linear_term
 *         sigma_mat = self.convert_vec_to_mat(sig)             # <<<<<<<<<<<<<<
 *         linear_term = np.dot(self.J_mat, sigma_mat) + np.dot(sigma_mat, (self.J_mat).T)
 *         linear_term_vec = linear_term[(self.rows, self.cols)]
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR_type *)__pyx_v_self->__pyx_vtab)->convert_vec_to_mat(__pyx_v_self, __pyx_v_sig, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3550, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_sigma_mat = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":3551
 *             np.ndarray[DTYPE_t, ndim=2] linear_term
 *         sigma_mat = self.convert_vec_to_mat(sig)
 *         linear_term = np.dot(self.J_mat, sigma_mat) + np.dot(sigma_mat, (self.J_mat).T)             # <<<<<<<<<<<<<<
 *         linear_term_vec = linear_term[(self.rows, self.cols)]
 *         for i in range(self.vec_size):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sigma_mat, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_self->J_mat), __pyx_t_4};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_self->J_mat), __pyx_t_4};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self->J_mat));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->J_mat));
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_self->J_mat));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_sigma_mat, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->J_mat), __pyx_n_s_T); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_6};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_6};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_6);
    __pyx_t_8 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3551, __pyx_L1_error)
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_term.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_term.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_term.rcbuffer->pybuffer, (PyObject*)__pyx_v_linear_term, &__Pyx_TypeInfo_nn___pyx_t_6pyross_9inference_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __pyx_t_12 = __pyx_t_13 = __pyx_t_14 = 0;
    }
    __pyx_pybuffernd_linear_term.diminfo[0].strides = __pyx_pybuffernd_linear_term.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_term.diminfo[0].shape = __pyx_pybuffernd_linear_term.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_linear_term.diminfo[1].strides = __pyx_pybuffernd_linear_term.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_linear_term.diminfo[1].shape = __pyx_pybuffernd_linear_term.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3551, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_linear_term = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3552
 *         sigma_mat = self.convert_vec_to_mat(sig)
 *         linear_term = np.dot(self.J_mat, sigma_mat) + np.dot(sigma_mat, (self.J_mat).T)
 *         linear_term_vec = linear_term[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 *         for i in range(self.vec_size):
 *             dsigdt[i] = B_vec[i] + linear_term_vec[i]
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->rows));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cols));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self->cols));
  __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_linear_term), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3552, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_linear_term_vec = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3553
 *         linear_term = np.dot(self.J_mat, sigma_mat) + np.dot(sigma_mat, (self.J_mat).T)
 *         linear_term_vec = linear_term[(self.rows, self.cols)]
 *         for i in range(self.vec_size):             # <<<<<<<<<<<<<<
 *             dsigdt[i] = B_vec[i] + linear_term_vec[i]
 * 
 */
  __pyx_t_15 = __pyx_v_self->vec_size;
  __pyx_t_16 = __pyx_t_15;
  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
    __pyx_v_i = __pyx_t_17;

    /* "pyross/inference.pyx":3554
 *         linear_term_vec = linear_term[(self.rows, self.cols)]
 *         for i in range(self.vec_size):
 *             dsigdt[i] = B_vec[i] + linear_term_vec[i]             # <<<<<<<<<<<<<<
 * 
 *     cpdef convert_vec_to_mat(self, double [:] cov):
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_19 = __pyx_v_i;
    __pyx_t_20 = __pyx_v_i;
    *((double *) ( /* dim=0 */ (__pyx_v_dsigdt.data + __pyx_t_20 * __pyx_v_dsigdt.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_B_vec.data + __pyx_t_18 * __pyx_v_B_vec.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_linear_term_vec.data + __pyx_t_19 * __pyx_v_linear_term_vec.strides[0]) ))));
  }

  /* "pyross/inference.pyx":3544
 *         return sol_vec
 * 
 *     cdef _compute_dsigdt(self, double [:] sig):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, j
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_term.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pyross.inference.SIR_type._compute_dsigdt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_term.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_dsigdt, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_B_vec, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_linear_term_vec, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_sigma_mat, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_linear_term);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3556
 *             dsigdt[i] = B_vec[i] + linear_term_vec[i]
 * 
 *     cpdef convert_vec_to_mat(self, double [:] cov):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] cov_mat
 */

static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_145convert_vec_to_mat(PyObject *__pyx_v_self, PyObject *__pyx_arg_cov); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_8SIR_type_convert_vec_to_mat(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_cov, int __pyx_skip_dispatch) {
  __Pyx_memviewslice __pyx_v_cov_mat = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_v_dim;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  __Pyx_RefNannySetupContext("convert_vec_to_mat", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_convert_vec_to_mat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_8SIR_type_145convert_vec_to_mat)) {
        __Pyx_XDECREF(__pyx_r);
        if (unlikely(!__pyx_v_cov.memview)) { __Pyx_RaiseUnboundLocalError("cov"); __PYX_ERR(0, 3556, __pyx_L1_error) }
        __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_cov, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __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);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":3559
 *         cdef:
 *             double [:, :] cov_mat
 *             Py_ssize_t i, j, count=0, dim=self.dim             # <<<<<<<<<<<<<<
 *         cov_mat = np.empty((dim, dim), dtype=DTYPE)
 *         for i in range(dim):
 */
  __pyx_v_count = 0;
  __pyx_t_6 = __pyx_v_self->dim;
  __pyx_v_dim = __pyx_t_6;

  /* "pyross/inference.pyx":3560
 *             double [:, :] cov_mat
 *             Py_ssize_t i, j, count=0, dim=self.dim
 *         cov_mat = np.empty((dim, dim), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         for i in range(dim):
 *             cov_mat[i, i] = cov[count]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 3560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cov_mat = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "pyross/inference.pyx":3561
 *             Py_ssize_t i, j, count=0, dim=self.dim
 *         cov_mat = np.empty((dim, dim), dtype=DTYPE)
 *         for i in range(dim):             # <<<<<<<<<<<<<<
 *             cov_mat[i, i] = cov[count]
 *             count += 1
 */
  __pyx_t_6 = __pyx_v_dim;
  __pyx_t_8 = __pyx_t_6;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "pyross/inference.pyx":3562
 *         cov_mat = np.empty((dim, dim), dtype=DTYPE)
 *         for i in range(dim):
 *             cov_mat[i, i] = cov[count]             # <<<<<<<<<<<<<<
 *             count += 1
 *             for j in range(i+1, dim):
 */
    __pyx_t_10 = __pyx_v_count;
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = __pyx_v_i;
    *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cov_mat.data + __pyx_t_11 * __pyx_v_cov_mat.strides[0]) ) + __pyx_t_12 * __pyx_v_cov_mat.strides[1]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_cov.data + __pyx_t_10 * __pyx_v_cov.strides[0]) )));

    /* "pyross/inference.pyx":3563
 *         for i in range(dim):
 *             cov_mat[i, i] = cov[count]
 *             count += 1             # <<<<<<<<<<<<<<
 *             for j in range(i+1, dim):
 *                 cov_mat[i, j] = cov[count]
 */
    __pyx_v_count = (__pyx_v_count + 1);

    /* "pyross/inference.pyx":3564
 *             cov_mat[i, i] = cov[count]
 *             count += 1
 *             for j in range(i+1, dim):             # <<<<<<<<<<<<<<
 *                 cov_mat[i, j] = cov[count]
 *                 cov_mat[j, i] = cov[count]
 */
    __pyx_t_13 = __pyx_v_dim;
    __pyx_t_14 = __pyx_t_13;
    for (__pyx_t_15 = (__pyx_v_i + 1); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
      __pyx_v_j = __pyx_t_15;

      /* "pyross/inference.pyx":3565
 *             count += 1
 *             for j in range(i+1, dim):
 *                 cov_mat[i, j] = cov[count]             # <<<<<<<<<<<<<<
 *                 cov_mat[j, i] = cov[count]
 *                 count += 1
 */
      __pyx_t_16 = __pyx_v_count;
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = __pyx_v_j;
      *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cov_mat.data + __pyx_t_17 * __pyx_v_cov_mat.strides[0]) ) + __pyx_t_18 * __pyx_v_cov_mat.strides[1]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_cov.data + __pyx_t_16 * __pyx_v_cov.strides[0]) )));

      /* "pyross/inference.pyx":3566
 *             for j in range(i+1, dim):
 *                 cov_mat[i, j] = cov[count]
 *                 cov_mat[j, i] = cov[count]             # <<<<<<<<<<<<<<
 *                 count += 1
 *         return cov_mat
 */
      __pyx_t_19 = __pyx_v_count;
      __pyx_t_20 = __pyx_v_j;
      __pyx_t_21 = __pyx_v_i;
      *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cov_mat.data + __pyx_t_20 * __pyx_v_cov_mat.strides[0]) ) + __pyx_t_21 * __pyx_v_cov_mat.strides[1]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_cov.data + __pyx_t_19 * __pyx_v_cov.strides[0]) )));

      /* "pyross/inference.pyx":3567
 *                 cov_mat[i, j] = cov[count]
 *                 cov_mat[j, i] = cov[count]
 *                 count += 1             # <<<<<<<<<<<<<<
 *         return cov_mat
 * 
 */
      __pyx_v_count = (__pyx_v_count + 1);
    }
  }

  /* "pyross/inference.pyx":3568
 *                 cov_mat[j, i] = cov[count]
 *                 count += 1
 *         return cov_mat             # <<<<<<<<<<<<<<
 * 
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_cov_mat, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3556
 *             dsigdt[i] = B_vec[i] + linear_term_vec[i]
 * 
 *     cpdef convert_vec_to_mat(self, double [:] cov):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] cov_mat
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.convert_vec_to_mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov_mat, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_145convert_vec_to_mat(PyObject *__pyx_v_self, PyObject *__pyx_arg_cov); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_145convert_vec_to_mat(PyObject *__pyx_v_self, PyObject *__pyx_arg_cov) {
  __Pyx_memviewslice __pyx_v_cov = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_vec_to_mat (wrapper)", 0);
  assert(__pyx_arg_cov); {
    __pyx_v_cov = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_arg_cov, PyBUF_WRITABLE); if (unlikely(!__pyx_v_cov.memview)) __PYX_ERR(0, 3556, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.convert_vec_to_mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_144convert_vec_to_mat(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_cov);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_144convert_vec_to_mat(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_cov) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convert_vec_to_mat", 0);
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_cov.memview)) { __Pyx_RaiseUnboundLocalError("cov"); __PYX_ERR(0, 3556, __pyx_L1_error) }
  __pyx_t_1 = __pyx_f_6pyross_9inference_8SIR_type_convert_vec_to_mat(__pyx_v_self, __pyx_v_cov, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.convert_vec_to_mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_cov, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3570
 *         return cov_mat
 * 
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):             # <<<<<<<<<<<<<<
 *         if (contactMatrix is None) == (generator is None):
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_147_process_contact_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_147_process_contact_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_contactMatrix = 0;
  PyObject *__pyx_v_generator = 0;
  PyObject *__pyx_v_intervention_fun = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_process_contact_matrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_contactMatrix,&__pyx_n_s_generator,&__pyx_n_s_intervention_fun,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contactMatrix)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generator)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_process_contact_matrix", 1, 3, 3, 1); __PYX_ERR(0, 3570, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervention_fun)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_process_contact_matrix", 1, 3, 3, 2); __PYX_ERR(0, 3570, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_process_contact_matrix") < 0)) __PYX_ERR(0, 3570, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_contactMatrix = values[0];
    __pyx_v_generator = values[1];
    __pyx_v_intervention_fun = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_process_contact_matrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3570, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type._process_contact_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_146_process_contact_matrix(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_contactMatrix, __pyx_v_generator, __pyx_v_intervention_fun);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_146_process_contact_matrix(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v_contactMatrix, PyObject *__pyx_v_generator, PyObject *__pyx_v_intervention_fun) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_process_contact_matrix", 0);

  /* "pyross/inference.pyx":3571
 * 
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):
 *         if (contactMatrix is None) == (generator is None):             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 *         if (intervention_fun is not None) and (generator is None):
 */
  __pyx_t_1 = (__pyx_v_contactMatrix == Py_None);
  __pyx_t_2 = (__pyx_v_generator == Py_None);
  __pyx_t_3 = ((__pyx_t_1 == __pyx_t_2) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":3572
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):
 *         if (contactMatrix is None) == (generator is None):
 *             raise Exception('Specify either a fixed contactMatrix or a generator')             # <<<<<<<<<<<<<<
 *         if (intervention_fun is not None) and (generator is None):
 *             raise Exception('Specify a generator')
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 3572, __pyx_L1_error)

    /* "pyross/inference.pyx":3571
 * 
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):
 *         if (contactMatrix is None) == (generator is None):             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 *         if (intervention_fun is not None) and (generator is None):
 */
  }

  /* "pyross/inference.pyx":3573
 *         if (contactMatrix is None) == (generator is None):
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 *         if (intervention_fun is not None) and (generator is None):             # <<<<<<<<<<<<<<
 *             raise Exception('Specify a generator')
 *         if contactMatrix is not None:
 */
  __pyx_t_2 = (__pyx_v_intervention_fun != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_3 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_generator == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pyross/inference.pyx":3574
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 *         if (intervention_fun is not None) and (generator is None):
 *             raise Exception('Specify a generator')             # <<<<<<<<<<<<<<
 *         if contactMatrix is not None:
 *             self.contactMatrix = contactMatrix
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 3574, __pyx_L1_error)

    /* "pyross/inference.pyx":3573
 *         if (contactMatrix is None) == (generator is None):
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 *         if (intervention_fun is not None) and (generator is None):             # <<<<<<<<<<<<<<
 *             raise Exception('Specify a generator')
 *         if contactMatrix is not None:
 */
  }

  /* "pyross/inference.pyx":3575
 *         if (intervention_fun is not None) and (generator is None):
 *             raise Exception('Specify a generator')
 *         if contactMatrix is not None:             # <<<<<<<<<<<<<<
 *             self.contactMatrix = contactMatrix
 * 
 */
  __pyx_t_3 = (__pyx_v_contactMatrix != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":3576
 *             raise Exception('Specify a generator')
 *         if contactMatrix is not None:
 *             self.contactMatrix = contactMatrix             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_INCREF(__pyx_v_contactMatrix);
    __Pyx_GIVEREF(__pyx_v_contactMatrix);
    __Pyx_GOTREF(__pyx_v_self->contactMatrix);
    __Pyx_DECREF(__pyx_v_self->contactMatrix);
    __pyx_v_self->contactMatrix = __pyx_v_contactMatrix;

    /* "pyross/inference.pyx":3575
 *         if (intervention_fun is not None) and (generator is None):
 *             raise Exception('Specify a generator')
 *         if contactMatrix is not None:             # <<<<<<<<<<<<<<
 *             self.contactMatrix = contactMatrix
 * 
 */
  }

  /* "pyross/inference.pyx":3570
 *         return cov_mat
 * 
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):             # <<<<<<<<<<<<<<
 *         if (contactMatrix is None) == (generator is None):
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SIR_type._process_contact_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3579
 * 
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                              b_matrix=True, jacobian=False):
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 */

static PyObject *__pyx_f_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_x, CYTHON_UNUSED double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
  }

  /* "pyross/inference.pyx":3581
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                              b_matrix=True, jacobian=False):
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")             # <<<<<<<<<<<<<<
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 3581, __pyx_L1_error)

  /* "pyross/inference.pyx":3579
 * 
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                              b_matrix=True, jacobian=False):
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3583
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,             # <<<<<<<<<<<<<<
 *                   dense_output=False, maxNumSteps=100000):
 *         """An light weight integrate method similar to `simulate` in pyross.deterministic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_149integrate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pyross_9inference_8SIR_type_148integrate[] = "An light weight integrate method similar to `simulate` in pyross.deterministic\n\n        Parameters\n        ----------\n        x0: np.array\n            Initial state of the given model\n        t1: float\n            Initial time of integrator\n        t2: float\n            Final time of integrator\n        steps: int\n            Number of time steps for numerical integrator evaluation.\n        maxNumSteps: int, optional\n            The maximum number of steps taken by the integrator.\n\n        Returns\n        -------\n        sol: np.array\n            The state of the system evaulated at the time point specified. Only used if det_method is set to 'solve_ivp'.\n        ";
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_149integrate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_x0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_t1;
  double __pyx_v_t2;
  Py_ssize_t __pyx_v_steps;
  PyObject *__pyx_v_dense_output = 0;
  PyObject *__pyx_v_maxNumSteps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("integrate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x0,&__pyx_n_s_t1,&__pyx_n_s_t2,&__pyx_n_s_steps,&__pyx_n_s_dense_output,&__pyx_n_s_maxNumSteps,0};
    PyObject* values[6] = {0,0,0,0,0,0};

    /* "pyross/inference.pyx":3584
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,
 *                   dense_output=False, maxNumSteps=100000):             # <<<<<<<<<<<<<<
 *         """An light weight integrate method similar to `simulate` in pyross.deterministic
 * 
 */
    values[4] = ((PyObject *)Py_False);
    values[5] = ((PyObject *)__pyx_int_100000);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("integrate", 0, 4, 6, 1); __PYX_ERR(0, 3583, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("integrate", 0, 4, 6, 2); __PYX_ERR(0, 3583, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("integrate", 0, 4, 6, 3); __PYX_ERR(0, 3583, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dense_output);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxNumSteps);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate") < 0)) __PYX_ERR(0, 3583, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x0 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x0.memview)) __PYX_ERR(0, 3583, __pyx_L3_error)
    __pyx_v_t1 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3583, __pyx_L3_error)
    __pyx_v_t2 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_t2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3583, __pyx_L3_error)
    __pyx_v_steps = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_steps == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3583, __pyx_L3_error)
    __pyx_v_dense_output = values[4];
    __pyx_v_maxNumSteps = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("integrate", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3583, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_148integrate(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0, __pyx_v_t1, __pyx_v_t2, __pyx_v_steps, __pyx_v_dense_output, __pyx_v_maxNumSteps);

  /* "pyross/inference.pyx":3583
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,             # <<<<<<<<<<<<<<
 *                   dense_output=False, maxNumSteps=100000):
 *         """An light weight integrate method similar to `simulate` in pyross.deterministic
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3606
 *         """
 * 
 *         def rhs0(double t, double [:] xt):             # <<<<<<<<<<<<<<
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(xt, t)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_9integrate_1rhs0(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_8SIR_type_9integrate_1rhs0 = {"rhs0", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_9integrate_1rhs0, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_9integrate_1rhs0(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_t;
  __Pyx_memviewslice __pyx_v_xt = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rhs0 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_xt,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rhs0", 1, 2, 2, 1); __PYX_ERR(0, 3606, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rhs0") < 0)) __PYX_ERR(0, 3606, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3606, __pyx_L3_error)
    __pyx_v_xt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xt.memview)) __PYX_ERR(0, 3606, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rhs0", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3606, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR_type.integrate.rhs0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_9integrate_rhs0(__pyx_self, __pyx_v_t, __pyx_v_xt);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_9integrate_rhs0(PyObject *__pyx_self, double __pyx_v_t, __Pyx_memviewslice __pyx_v_xt) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *__pyx_cur_scope;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("rhs0", 0);
  __pyx_outer_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "pyross/inference.pyx":3607
 * 
 *         def rhs0(double t, double [:] xt):
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)             # <<<<<<<<<<<<<<
 *             self.det_model.rhs(xt, t)
 *             return self.det_model.dxdt
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3607, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_contactMatrix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3607, __pyx_L1_error) }
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_cur_scope->__pyx_v_self->contactMatrix};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3607, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_cur_scope->__pyx_v_self->contactMatrix};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3607, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->contactMatrix);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->contactMatrix);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_self->contactMatrix);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3608
 *         def rhs0(double t, double [:] xt):
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(xt, t)             # <<<<<<<<<<<<<<
 *             return self.det_model.dxdt
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3608, __pyx_L1_error) }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rhs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xt, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3608, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3608, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3609
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(xt, t)
 *             return self.det_model.dxdt             # <<<<<<<<<<<<<<
 * 
 *         x0 = np.multiply(x0, self.Omega)
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3609, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_det_model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3606
 *         """
 * 
 *         def rhs0(double t, double [:] xt):             # <<<<<<<<<<<<<<
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(xt, t)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SIR_type.integrate.rhs0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_xt, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3583
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,             # <<<<<<<<<<<<<<
 *                   dense_output=False, maxNumSteps=100000):
 *         """An light weight integrate method similar to `simulate` in pyross.deterministic
 */

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_148integrate(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, __Pyx_memviewslice __pyx_v_x0, double __pyx_v_t1, double __pyx_v_t2, Py_ssize_t __pyx_v_steps, PyObject *__pyx_v_dense_output, PyObject *__pyx_v_maxNumSteps) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *__pyx_cur_scope;
  PyObject *__pyx_v_rhs0 = 0;
  PyObject *__pyx_v_time_points = NULL;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("integrate", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *)__pyx_tp_new_6pyross_9inference___pyx_scope_struct_9_integrate(__pyx_ptype_6pyross_9inference___pyx_scope_struct_9_integrate, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3583, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "pyross/inference.pyx":3606
 *         """
 * 
 *         def rhs0(double t, double [:] xt):             # <<<<<<<<<<<<<<
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(xt, t)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pyross_9inference_8SIR_type_9integrate_1rhs0, 0, __pyx_n_s_integrate_locals_rhs0, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyross_inference, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rhs0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3611
 *             return self.det_model.dxdt
 * 
 *         x0 = np.multiply(x0, self.Omega)             # <<<<<<<<<<<<<<
 *         time_points = np.linspace(t1, t2, steps)
 *         res = solve_ivp(rhs0, [t1,t2], x0, method=self.det_method,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_multiply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3611, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 3611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __pyx_v_x0 = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "pyross/inference.pyx":3612
 * 
 *         x0 = np.multiply(x0, self.Omega)
 *         time_points = np.linspace(t1, t2, steps)             # <<<<<<<<<<<<<<
 *         res = solve_ivp(rhs0, [t1,t2], x0, method=self.det_method,
 *                         t_eval=time_points, dense_output=dense_output,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_6, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_time_points = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3613
 *         x0 = np.multiply(x0, self.Omega)
 *         time_points = np.linspace(t1, t2, steps)
 *         res = solve_ivp(rhs0, [t1,t2], x0, method=self.det_method,             # <<<<<<<<<<<<<<
 *                         t_eval=time_points, dense_output=dense_output,
 *                         max_step=maxNumSteps, rtol=self.rtol_det)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_solve_ivp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_t1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_t2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
  __pyx_t_7 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_x0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_rhs0);
  __Pyx_GIVEREF(__pyx_v_rhs0);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_rhs0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_9);
  __pyx_t_2 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_method, __pyx_cur_scope->__pyx_v_self->det_method) < 0) __PYX_ERR(0, 3613, __pyx_L1_error)

  /* "pyross/inference.pyx":3614
 *         time_points = np.linspace(t1, t2, steps)
 *         res = solve_ivp(rhs0, [t1,t2], x0, method=self.det_method,
 *                         t_eval=time_points, dense_output=dense_output,             # <<<<<<<<<<<<<<
 *                         max_step=maxNumSteps, rtol=self.rtol_det)
 *         y = np.divide(res.y.T, self.Omega)
 */
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_t_eval, __pyx_v_time_points) < 0) __PYX_ERR(0, 3613, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dense_output, __pyx_v_dense_output) < 0) __PYX_ERR(0, 3613, __pyx_L1_error)

  /* "pyross/inference.pyx":3615
 *         res = solve_ivp(rhs0, [t1,t2], x0, method=self.det_method,
 *                         t_eval=time_points, dense_output=dense_output,
 *                         max_step=maxNumSteps, rtol=self.rtol_det)             # <<<<<<<<<<<<<<
 *         y = np.divide(res.y.T, self.Omega)
 * 
 */
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_max_step, __pyx_v_maxNumSteps) < 0) __PYX_ERR(0, 3613, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->rtol_det); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_rtol, __pyx_t_2) < 0) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3613
 *         x0 = np.multiply(x0, self.Omega)
 *         time_points = np.linspace(t1, t2, steps)
 *         res = solve_ivp(rhs0, [t1,t2], x0, method=self.det_method,             # <<<<<<<<<<<<<<
 *                         t_eval=time_points, dense_output=dense_output,
 *                         max_step=maxNumSteps, rtol=self.rtol_det)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_res = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3616
 *                         t_eval=time_points, dense_output=dense_output,
 *                         max_step=maxNumSteps, rtol=self.rtol_det)
 *         y = np.divide(res.y.T, self.Omega)             # <<<<<<<<<<<<<<
 * 
 *         if dense_output:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_divide); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_T); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->Omega); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3616, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3616, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_9);
    __pyx_t_1 = 0;
    __pyx_t_9 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":3618
 *         y = np.divide(res.y.T, self.Omega)
 * 
 *         if dense_output:             # <<<<<<<<<<<<<<
 *             return y, res.sol
 *         else:
 */
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_dense_output); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3618, __pyx_L1_error)
  if (__pyx_t_10) {

    /* "pyross/inference.pyx":3619
 * 
 *         if dense_output:
 *             return y, res.sol             # <<<<<<<<<<<<<<
 *         else:
 *             return y
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_sol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "pyross/inference.pyx":3618
 *         y = np.divide(res.y.T, self.Omega)
 * 
 *         if dense_output:             # <<<<<<<<<<<<<<
 *             return y, res.sol
 *         else:
 */
  }

  /* "pyross/inference.pyx":3621
 *             return y, res.sol
 *         else:
 *             return y             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_y);
    __pyx_r = __pyx_v_y;
    goto __pyx_L0;
  }

  /* "pyross/inference.pyx":3583
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,             # <<<<<<<<<<<<<<
 *                   dense_output=False, maxNumSteps=100000):
 *         """An light weight integrate method similar to `simulate` in pyross.deterministic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SIR_type.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhs0);
  __Pyx_XDECREF(__pyx_v_time_points);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_y);
  __PYX_XDEC_MEMVIEW(&__pyx_v_x0, 1);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":61
 * 
 *     cdef:
 *         readonly Py_ssize_t nClass, M, steps, dim, vec_size             # <<<<<<<<<<<<<<
 *         readonly double Omega, rtol_det, rtol_lyapunov
 *         readonly np.ndarray beta, gIa, gIs, fsa, _xm
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_6nClass_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_6nClass_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_6nClass___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_6nClass___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->nClass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.nClass.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1M_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1M_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_1M___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1M___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.M.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5steps_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5steps_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_5steps___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5steps___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->steps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.steps.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3dim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3dim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3dim___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3dim___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.dim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_8vec_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_8vec_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_8vec_size___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8vec_size___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->vec_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.vec_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":62
 *     cdef:
 *         readonly Py_ssize_t nClass, M, steps, dim, vec_size
 *         readonly double Omega, rtol_det, rtol_lyapunov             # <<<<<<<<<<<<<<
 *         readonly np.ndarray beta, gIa, gIs, fsa, _xm
 *         readonly np.ndarray alpha, fi, CM, dsigmadt, J, B, J_mat, B_vec, U
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5Omega_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5Omega_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_5Omega___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5Omega___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.Omega.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_8rtol_det_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_8rtol_det_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_8rtol_det___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8rtol_det___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->rtol_det); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.rtol_det.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13rtol_lyapunov_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13rtol_lyapunov_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_13rtol_lyapunov___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13rtol_lyapunov___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->rtol_lyapunov); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.rtol_lyapunov.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":63
 *         readonly Py_ssize_t nClass, M, steps, dim, vec_size
 *         readonly double Omega, rtol_det, rtol_lyapunov
 *         readonly np.ndarray beta, gIa, gIs, fsa, _xm             # <<<<<<<<<<<<<<
 *         readonly np.ndarray alpha, fi, CM, dsigmadt, J, B, J_mat, B_vec, U
 *         readonly np.ndarray flat_indices1, flat_indices2, flat_indices, rows, cols
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_4beta_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_4beta_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_4beta___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4beta___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->beta));
  __pyx_r = ((PyObject *)__pyx_v_self->beta);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3gIa_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3gIa_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3gIa___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3gIa___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gIa));
  __pyx_r = ((PyObject *)__pyx_v_self->gIa);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3gIs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3gIs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3gIs___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3gIs___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gIs));
  __pyx_r = ((PyObject *)__pyx_v_self->gIs);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3fsa_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3fsa_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3fsa___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3fsa___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fsa));
  __pyx_r = ((PyObject *)__pyx_v_self->fsa);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3_xm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_3_xm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_3_xm___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_3_xm___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_xm));
  __pyx_r = ((PyObject *)__pyx_v_self->_xm);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":64
 *         readonly double Omega, rtol_det, rtol_lyapunov
 *         readonly np.ndarray beta, gIa, gIs, fsa, _xm
 *         readonly np.ndarray alpha, fi, CM, dsigmadt, J, B, J_mat, B_vec, U             # <<<<<<<<<<<<<<
 *         readonly np.ndarray flat_indices1, flat_indices2, flat_indices, rows, cols
 *         readonly str det_method, lyapunov_method
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5alpha_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5alpha_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_5alpha___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5alpha___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->alpha));
  __pyx_r = ((PyObject *)__pyx_v_self->alpha);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_2fi_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_2fi_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_2fi___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_2fi___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fi));
  __pyx_r = ((PyObject *)__pyx_v_self->fi);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_2CM_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_2CM_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_2CM___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_2CM___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->CM));
  __pyx_r = ((PyObject *)__pyx_v_self->CM);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_8dsigmadt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_8dsigmadt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_8dsigmadt___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_8dsigmadt___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->dsigmadt));
  __pyx_r = ((PyObject *)__pyx_v_self->dsigmadt);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1J_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1J_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_1J___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1J___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->J));
  __pyx_r = ((PyObject *)__pyx_v_self->J);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1B_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1B_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_1B___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1B___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->B));
  __pyx_r = ((PyObject *)__pyx_v_self->B);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5J_mat_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5J_mat_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_5J_mat___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5J_mat___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->J_mat));
  __pyx_r = ((PyObject *)__pyx_v_self->J_mat);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5B_vec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_5B_vec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_5B_vec___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_5B_vec___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->B_vec));
  __pyx_r = ((PyObject *)__pyx_v_self->B_vec);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1U_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_1U_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_1U___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_1U___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->U));
  __pyx_r = ((PyObject *)__pyx_v_self->U);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":65
 *         readonly np.ndarray beta, gIa, gIs, fsa, _xm
 *         readonly np.ndarray alpha, fi, CM, dsigmadt, J, B, J_mat, B_vec, U
 *         readonly np.ndarray flat_indices1, flat_indices2, flat_indices, rows, cols             # <<<<<<<<<<<<<<
 *         readonly str det_method, lyapunov_method
 *         readonly dict class_index_dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13flat_indices1_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13flat_indices1_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_13flat_indices1___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13flat_indices1___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->flat_indices1));
  __pyx_r = ((PyObject *)__pyx_v_self->flat_indices1);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13flat_indices2_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13flat_indices2_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_13flat_indices2___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13flat_indices2___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->flat_indices2));
  __pyx_r = ((PyObject *)__pyx_v_self->flat_indices2);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_12flat_indices_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_12flat_indices_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_12flat_indices___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_12flat_indices___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->flat_indices));
  __pyx_r = ((PyObject *)__pyx_v_self->flat_indices);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_4rows_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_4rows_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_4rows___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4rows___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->rows));
  __pyx_r = ((PyObject *)__pyx_v_self->rows);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_4cols_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_4cols_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_4cols___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_4cols___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->cols));
  __pyx_r = ((PyObject *)__pyx_v_self->cols);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":66
 *         readonly np.ndarray alpha, fi, CM, dsigmadt, J, B, J_mat, B_vec, U
 *         readonly np.ndarray flat_indices1, flat_indices2, flat_indices, rows, cols
 *         readonly str det_method, lyapunov_method             # <<<<<<<<<<<<<<
 *         readonly dict class_index_dict
 *         readonly list param_keys, _interp
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10det_method_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10det_method_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_10det_method___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10det_method___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->det_method);
  __pyx_r = __pyx_v_self->det_method;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_15lyapunov_method_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_15lyapunov_method_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_15lyapunov_method___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_15lyapunov_method___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->lyapunov_method);
  __pyx_r = __pyx_v_self->lyapunov_method;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":67
 *         readonly np.ndarray flat_indices1, flat_indices2, flat_indices, rows, cols
 *         readonly str det_method, lyapunov_method
 *         readonly dict class_index_dict             # <<<<<<<<<<<<<<
 *         readonly list param_keys, _interp
 *         readonly object contactMatrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_16class_index_dict_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_16class_index_dict_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_16class_index_dict___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_16class_index_dict___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->class_index_dict);
  __pyx_r = __pyx_v_self->class_index_dict;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":68
 *         readonly str det_method, lyapunov_method
 *         readonly dict class_index_dict
 *         readonly list param_keys, _interp             # <<<<<<<<<<<<<<
 *         readonly object contactMatrix
 *         readonly bint param_mapping_enabled
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10param_keys_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_10param_keys_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_10param_keys___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_10param_keys___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->param_keys);
  __pyx_r = __pyx_v_self->param_keys;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7_interp_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_7_interp_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_7_interp___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_7_interp___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_interp);
  __pyx_r = __pyx_v_self->_interp;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":69
 *         readonly dict class_index_dict
 *         readonly list param_keys, _interp
 *         readonly object contactMatrix             # <<<<<<<<<<<<<<
 *         readonly bint param_mapping_enabled
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13contactMatrix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_13contactMatrix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_13contactMatrix___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_13contactMatrix___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->contactMatrix);
  __pyx_r = __pyx_v_self->contactMatrix;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":70
 *         readonly list param_keys, _interp
 *         readonly object contactMatrix
 *         readonly bint param_mapping_enabled             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_21param_mapping_enabled_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_21param_mapping_enabled_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_21param_mapping_enabled___get__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_21param_mapping_enabled___get__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->param_mapping_enabled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.param_mapping_enabled.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_151__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_151__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_150__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_150__reduce_cython__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(34); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->U));
  __Pyx_INCREF(__pyx_v_self->_interp);
  __Pyx_GIVEREF(__pyx_v_self->_interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->_interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->_xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->beta));
  __Pyx_INCREF(__pyx_v_self->class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->cols));
  __Pyx_INCREF(__pyx_v_self->contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_v_self->contactMatrix);
  __Pyx_INCREF(__pyx_v_self->det_method);
  __Pyx_GIVEREF(__pyx_v_self->det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->det_method);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 17, ((PyObject *)__pyx_v_self->dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->fi));
  PyTuple_SET_ITEM(__pyx_t_10, 18, ((PyObject *)__pyx_v_self->fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->gIs));
  __Pyx_INCREF(__pyx_v_self->lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 25, __pyx_v_self->lyapunov_method);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 26, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->param_keys);
  __Pyx_GIVEREF(__pyx_v_self->param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 27, __pyx_v_self->param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 28, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->rows));
  PyTuple_SET_ITEM(__pyx_t_10, 29, ((PyObject *)__pyx_v_self->rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 30, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 33, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->_interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->_xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->contactMatrix != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->det_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->dsigmadt) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->fi) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->flat_indices) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->flat_indices1) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->flat_indices2) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->fsa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->gIa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->gIs) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->param_keys != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->rows) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SIR_type); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_172004068);
    __Pyx_GIVEREF(__pyx_int_172004068);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_172004068);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, None), state
 *     else:
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SIR_type__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SIR_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_172004068);
    __Pyx_GIVEREF(__pyx_int_172004068);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_172004068);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR_type.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SIR_type__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_153__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SIR_type_153__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SIR_type_152__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SIR_type_152__setstate_cython__(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SIR_type__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SIR_type__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SIR_type, (type(self), 0xa4092e4, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SIR_type__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR_type.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3676
 *     cdef readonly pyross.deterministic.SIR det_model
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-4, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 3, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_3SIR_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_3SIR_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_1);
    values[4] = ((PyObject *)__pyx_int_4);
    values[5] = ((PyObject *)__pyx_n_u_LSODA);
    values[6] = ((PyObject *)__pyx_n_u_LSODA);
    values[7] = ((PyObject *)__pyx_float_1eneg_4);
    values[8] = ((PyObject *)__pyx_float_1eneg_3);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 1); __PYX_ERR(0, 3676, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 2); __PYX_ERR(0, 3676, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 3676, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parameters = values[0];
    __pyx_v_M = values[1];
    __pyx_v_fi = values[2];
    __pyx_v_Omega = values[3];
    __pyx_v_steps = values[4];
    __pyx_v_det_method = values[5];
    __pyx_v_lyapunov_method = values[6];
    __pyx_v_rtol_det = values[7];
    __pyx_v_rtol_lyapunov = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3676, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SIR.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR___init__(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self), __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_3SIR___init__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyross/inference.pyx":3677
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-4, rtol_lyapunov=1e-3):
 *         self.param_keys = ['alpha', 'beta', 'gIa', 'gIs', 'fsa']             # <<<<<<<<<<<<<<
 *         super().__init__(parameters, 3, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'Ia':1, 'Is':2}
 */
  __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_alpha);
  __Pyx_GIVEREF(__pyx_n_u_alpha);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_alpha);
  __Pyx_INCREF(__pyx_n_u_beta);
  __Pyx_GIVEREF(__pyx_n_u_beta);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_beta);
  __Pyx_INCREF(__pyx_n_u_gIa);
  __Pyx_GIVEREF(__pyx_n_u_gIa);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_gIa);
  __Pyx_INCREF(__pyx_n_u_gIs);
  __Pyx_GIVEREF(__pyx_n_u_gIs);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_gIs);
  __Pyx_INCREF(__pyx_n_u_fsa);
  __Pyx_GIVEREF(__pyx_n_u_fsa);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_u_fsa);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.param_keys);
  __pyx_v_self->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3678
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-4, rtol_lyapunov=1e-3):
 *         self.param_keys = ['alpha', 'beta', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 3, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)             # <<<<<<<<<<<<<<
 *         self.class_index_dict = {'S':0, 'Ia':1, 'Is':2}
 *         self.set_det_model(parameters)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SIR));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SIR));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SIR));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_3, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3678, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_3, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3678, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_int_3);
    __Pyx_GIVEREF(__pyx_int_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_3);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_rtol_lyapunov);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3679
 *         self.param_keys = ['alpha', 'beta', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 3, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'Ia':1, 'Is':2}             # <<<<<<<<<<<<<<
 *         self.set_det_model(parameters)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_S, __pyx_int_0) < 0) __PYX_ERR(0, 3679, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Ia, __pyx_int_1) < 0) __PYX_ERR(0, 3679, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Is, __pyx_int_2) < 0) __PYX_ERR(0, 3679, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.class_index_dict);
  __pyx_v_self->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3680
 *         super().__init__(parameters, 3, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'Ia':1, 'Is':2}
 *         self.set_det_model(parameters)             # <<<<<<<<<<<<<<
 * 
 *     def set_det_model(self, parameters):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3676
 *     cdef readonly pyross.deterministic.SIR det_model
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-4, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 3, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SIR.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3682
 *         self.set_det_model(parameters)
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SIR(parameters, self.M, self.fi*self.Omega)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3SIR_3set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3SIR_3set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR_2set_det_model(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3SIR_2set_det_model(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("set_det_model", 0);

  /* "pyross/inference.pyx":3683
 * 
 *     def set_det_model(self, parameters):
 *         self.det_model = pyross.deterministic.SIR(parameters, self.M, self.fi*self.Omega)             # <<<<<<<<<<<<<<
 * 
 *     def infection_indices(self):
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SIR), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_SIR *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3682
 *         self.set_det_model(parameters)
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SIR(parameters, self.M, self.fi*self.Omega)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SIR.set_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3685
 *         self.det_model = pyross.deterministic.SIR(parameters, self.M, self.fi*self.Omega)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return [1, 2]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3SIR_5infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3SIR_5infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR_4infection_indices(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3SIR_4infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("infection_indices", 0);

  /* "pyross/inference.pyx":3686
 * 
 *     def infection_indices(self):
 *         return [1, 2]             # <<<<<<<<<<<<<<
 * 
 *     def make_params_dict(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_2);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3685
 *         self.det_model = pyross.deterministic.SIR(parameters, self.M, self.fi*self.Omega)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return [1, 2]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR.infection_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3688
 *         return [1, 2]
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa, 'gIs':self.gIs, 'fsa':self.fsa}
 *         return parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3SIR_7make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3SIR_7make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR_6make_params_dict(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3SIR_6make_params_dict(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self) {
  PyObject *__pyx_v_parameters = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":3689
 * 
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa, 'gIs':self.gIs, 'fsa':self.fsa}             # <<<<<<<<<<<<<<
 *         return parameters
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_alpha, ((PyObject *)__pyx_v_self->__pyx_base.alpha)) < 0) __PYX_ERR(0, 3689, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_beta, ((PyObject *)__pyx_v_self->__pyx_base.beta)) < 0) __PYX_ERR(0, 3689, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIa, ((PyObject *)__pyx_v_self->__pyx_base.gIa)) < 0) __PYX_ERR(0, 3689, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIs, ((PyObject *)__pyx_v_self->__pyx_base.gIs)) < 0) __PYX_ERR(0, 3689, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fsa, ((PyObject *)__pyx_v_self->__pyx_base.fsa)) < 0) __PYX_ERR(0, 3689, __pyx_L1_error)
  __pyx_v_parameters = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3690
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa, 'gIs':self.gIs, 'fsa':self.fsa}
 *         return parameters             # <<<<<<<<<<<<<<
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_parameters);
  __pyx_r = __pyx_v_parameters;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3688
 *         return [1, 2]
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa, 'gIs':self.gIs, 'fsa':self.fsa}
 *         return parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3692
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                                 b_matrix=True, jacobian=False):
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix *__pyx_optional_args) {

  /* "pyross/inference.pyx":3693
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                                 b_matrix=True, jacobian=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] s, Ia, Is
 */
  PyObject *__pyx_v_b_matrix = ((PyObject *)Py_True);
  PyObject *__pyx_v_jacobian = ((PyObject *)Py_False);
  __Pyx_memviewslice __pyx_v_s = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Ia = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Is = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_M;
  __Pyx_memviewslice __pyx_v_l = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_b_matrix = __pyx_optional_args->b_matrix;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_jacobian = __pyx_optional_args->jacobian;
      }
    }
  }

  /* "pyross/inference.pyx":3696
 *         cdef:
 *             double [:] s, Ia, Is
 *             Py_ssize_t M=self.M             # <<<<<<<<<<<<<<
 *         s = x[0:M]
 *         Ia = x[M:2*M]
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":3697
 *             double [:] s, Ia, Is
 *             Py_ssize_t M=self.M
 *         s = x[0:M]             # <<<<<<<<<<<<<<
 *         Ia = x[M:2*M]
 *         Is = x[2*M:3*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    0,
    __pyx_v_M,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3697, __pyx_L1_error)
}

__pyx_v_s = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3698
 *             Py_ssize_t M=self.M
 *         s = x[0:M]
 *         Ia = x[M:2*M]             # <<<<<<<<<<<<<<
 *         Is = x[2*M:3*M]
 *         self.CM = self.contactMatrix(t)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    __pyx_v_M,
    (2 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3698, __pyx_L1_error)
}

__pyx_v_Ia = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3699
 *         s = x[0:M]
 *         Ia = x[M:2*M]
 *         Is = x[2*M:3*M]             # <<<<<<<<<<<<<<
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (2 * __pyx_v_M),
    (3 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3699, __pyx_L1_error)
}

__pyx_v_Is = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3700
 *         Ia = x[M:2*M]
 *         Is = x[2*M:3*M]
 *         self.CM = self.contactMatrix(t)             # <<<<<<<<<<<<<<
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __pyx_t_6 = __pyx_v_self->__pyx_base.contactMatrix; __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3700, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __pyx_v_self->__pyx_base.CM = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3701
 *         Is = x[2*M:3*M]
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_l = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3702
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)             # <<<<<<<<<<<<<<
 *         if b_matrix:
 *             self.noise_correlation(s, Ia, Is, l)
 */
  __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_lambdas(__pyx_v_self, __pyx_v_Ia, __pyx_v_Is, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":3703
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, Ia, Is, l)
 *         if jacobian:
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_b_matrix); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3703, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":3704
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:
 *             self.noise_correlation(s, Ia, Is, l)             # <<<<<<<<<<<<<<
 *         if jacobian:
 *             self.jacobian(s, l)
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR *)__pyx_v_self->__pyx_base.__pyx_vtab)->noise_correlation(__pyx_v_self, __pyx_v_s, __pyx_v_Ia, __pyx_v_Is, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3703
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, Ia, Is, l)
 *         if jacobian:
 */
  }

  /* "pyross/inference.pyx":3705
 *         if b_matrix:
 *             self.noise_correlation(s, Ia, Is, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, l)
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_jacobian); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3705, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":3706
 *             self.noise_correlation(s, Ia, Is, l)
 *         if jacobian:
 *             self.jacobian(s, l)             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SIR *)__pyx_v_self->__pyx_base.__pyx_vtab)->jacobian(__pyx_v_self, __pyx_v_s, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3705
 *         if b_matrix:
 *             self.noise_correlation(s, Ia, Is, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, l)
 * 
 */
  }

  /* "pyross/inference.pyx":3692
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                                 b_matrix=True, jacobian=False):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SIR.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_s, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ia, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Is, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_l, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3708
 *             self.jacobian(s, l)
 * 
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

static PyObject *__pyx_f_6pyross_9inference_3SIR_fill_lambdas(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l) {
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __Pyx_RefNannySetupContext("fill_lambdas", 0);

  /* "pyross/inference.pyx":3710
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):
 *         cdef:
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:] fsa=self.fsa, beta=self.beta
 *             double [:] fi=self.fi
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3710, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3711
 *         cdef:
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta             # <<<<<<<<<<<<<<
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3711, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3711, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3712
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3712, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3713
 *             double [:] fsa=self.fsa, beta=self.beta
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, M=self.M             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             for n in range(M):
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_3;

  /* "pyross/inference.pyx":3714
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 */
  __pyx_t_3 = __pyx_v_M;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_m = __pyx_t_5;

    /* "pyross/inference.pyx":3715
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 * 
 */
    __pyx_t_6 = __pyx_v_M;
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_n = __pyx_t_8;

      /* "pyross/inference.pyx":3716
 *         for m in range(M):
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]             # <<<<<<<<<<<<<<
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):
 */
      __pyx_t_9 = __pyx_v_m;
      __pyx_t_10 = __pyx_v_m;
      __pyx_t_11 = __pyx_v_n;
      __pyx_t_12 = __pyx_v_n;
      __pyx_t_13 = __pyx_v_n;
      __pyx_t_14 = __pyx_v_n;
      __pyx_t_15 = __pyx_v_n;
      __pyx_t_16 = __pyx_v_m;
      *((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_16 * __pyx_v_l.strides[0]) )) += ((((*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_9 * __pyx_v_beta.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_10 * __pyx_v_CM.strides[0]) ) + __pyx_t_11 * __pyx_v_CM.strides[1]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_12 * __pyx_v_Ia.strides[0]) ))) + ((*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_13 * __pyx_v_fsa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_14 * __pyx_v_Is.strides[0]) )))))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_15 * __pyx_v_fi.strides[0]) ))));
    }
  }

  /* "pyross/inference.pyx":3708
 *             self.jacobian(s, l)
 * 
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_AddTraceback("pyross.inference.SIR.fill_lambdas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3718
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

static PyObject *__pyx_f_6pyross_9inference_3SIR_jacobian(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  PyObject *__pyx_t_99 = NULL;
  PyObject *__pyx_t_100 = NULL;
  PyObject *__pyx_t_101 = NULL;
  PyObject *__pyx_t_102 = NULL;
  __Pyx_RefNannySetupContext("jacobian", 0);

  /* "pyross/inference.pyx":3720
 *     cdef jacobian(self, double [:] s, double [:] l):
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim             # <<<<<<<<<<<<<<
 *             double [:] gIa=self.gIa, gIs=self.gIs, fsa=self.fsa, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":3721
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double [:] gIa=self.gIa, gIs=self.gIs, fsa=self.fsa, beta=self.beta             # <<<<<<<<<<<<<<
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3722
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double [:] gIa=self.gIa, gIs=self.gIs, fsa=self.fsa, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3722, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_balpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3722, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3723
 *             double [:] gIa=self.gIa, gIs=self.gIs, fsa=self.fsa, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.J), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3723, __pyx_L1_error)
  __pyx_v_J = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":3724
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 3724, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":3725
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = alpha[m]*l[m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_6 = __pyx_t_1;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_m = __pyx_t_7;

    /* "pyross/inference.pyx":3726
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 0, m] = alpha[m]*l[m]
 *             J[2, m, 0, m] = balpha[m]*l[m]
 */
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_9 = 0;
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = 0;
    __pyx_t_12 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_9 * __pyx_v_J.strides[0]) ) + __pyx_t_10 * __pyx_v_J.strides[1]) ) + __pyx_t_11 * __pyx_v_J.strides[2]) ) + __pyx_t_12 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_8 * __pyx_v_l.strides[0]) ))));

    /* "pyross/inference.pyx":3727
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = alpha[m]*l[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 0, m] = balpha[m]*l[m]
 *             for n in range(M):
 */
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_14 = __pyx_v_m;
    __pyx_t_15 = 1;
    __pyx_t_16 = __pyx_v_m;
    __pyx_t_17 = 0;
    __pyx_t_18 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_15 * __pyx_v_J.strides[0]) ) + __pyx_t_16 * __pyx_v_J.strides[1]) ) + __pyx_t_17 * __pyx_v_J.strides[2]) ) + __pyx_t_18 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_13 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_14 * __pyx_v_l.strides[0]) ))));

    /* "pyross/inference.pyx":3728
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = alpha[m]*l[m]
 *             J[2, m, 0, m] = balpha[m]*l[m]             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 J[0, m, 1, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 */
    __pyx_t_19 = __pyx_v_m;
    __pyx_t_20 = __pyx_v_m;
    __pyx_t_21 = 2;
    __pyx_t_22 = __pyx_v_m;
    __pyx_t_23 = 0;
    __pyx_t_24 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_21 * __pyx_v_J.strides[0]) ) + __pyx_t_22 * __pyx_v_J.strides[1]) ) + __pyx_t_23 * __pyx_v_J.strides[2]) ) + __pyx_t_24 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_19 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_20 * __pyx_v_l.strides[0]) ))));

    /* "pyross/inference.pyx":3729
 *             J[1, m, 0, m] = alpha[m]*l[m]
 *             J[2, m, 0, m] = balpha[m]*l[m]
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 J[0, m, 1, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
    __pyx_t_25 = __pyx_v_M;
    __pyx_t_26 = __pyx_t_25;
    for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
      __pyx_v_n = __pyx_t_27;

      /* "pyross/inference.pyx":3730
 *             J[2, m, 0, m] = balpha[m]*l[m]
 *             for n in range(M):
 *                 J[0, m, 1, n] = -s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 1, n] = alpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_28 = __pyx_v_m;
      __pyx_t_29 = __pyx_v_m;
      __pyx_t_30 = __pyx_v_m;
      __pyx_t_31 = __pyx_v_n;
      __pyx_t_32 = __pyx_v_n;
      __pyx_t_33 = 0;
      __pyx_t_34 = __pyx_v_m;
      __pyx_t_35 = 1;
      __pyx_t_36 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_33 * __pyx_v_J.strides[0]) ) + __pyx_t_34 * __pyx_v_J.strides[1]) ) + __pyx_t_35 * __pyx_v_J.strides[2]) ) + __pyx_t_36 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_28 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_29 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_30 * __pyx_v_CM.strides[0]) ) + __pyx_t_31 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_32 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3731
 *             for n in range(M):
 *                 J[0, m, 1, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 1, n] = alpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 2, n] = alpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_37 = __pyx_v_m;
      __pyx_t_38 = __pyx_v_m;
      __pyx_t_39 = __pyx_v_m;
      __pyx_t_40 = __pyx_v_n;
      __pyx_t_41 = __pyx_v_n;
      __pyx_t_42 = __pyx_v_n;
      __pyx_t_43 = 0;
      __pyx_t_44 = __pyx_v_m;
      __pyx_t_45 = 2;
      __pyx_t_46 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_43 * __pyx_v_J.strides[0]) ) + __pyx_t_44 * __pyx_v_J.strides[1]) ) + __pyx_t_45 * __pyx_v_J.strides[2]) ) + __pyx_t_46 * __pyx_v_J.strides[3]) )) = (((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_37 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_38 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_39 * __pyx_v_CM.strides[0]) ) + __pyx_t_40 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_41 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_42 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3732
 *                 J[0, m, 1, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 1, n] = alpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 2, n] = alpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[2, m, 1, n] = balpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_47 = __pyx_v_m;
      __pyx_t_48 = __pyx_v_m;
      __pyx_t_49 = __pyx_v_m;
      __pyx_t_50 = __pyx_v_m;
      __pyx_t_51 = __pyx_v_n;
      __pyx_t_52 = __pyx_v_n;
      __pyx_t_53 = 1;
      __pyx_t_54 = __pyx_v_m;
      __pyx_t_55 = 1;
      __pyx_t_56 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_53 * __pyx_v_J.strides[0]) ) + __pyx_t_54 * __pyx_v_J.strides[1]) ) + __pyx_t_55 * __pyx_v_J.strides[2]) ) + __pyx_t_56 * __pyx_v_J.strides[3]) )) = (((((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_47 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_48 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_49 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_50 * __pyx_v_CM.strides[0]) ) + __pyx_t_51 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_52 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3733
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 1, n] = alpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 2, n] = alpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[2, m, 1, n] = balpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[2, m, 2, n] = balpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_57 = __pyx_v_m;
      __pyx_t_58 = __pyx_v_m;
      __pyx_t_59 = __pyx_v_m;
      __pyx_t_60 = __pyx_v_m;
      __pyx_t_61 = __pyx_v_n;
      __pyx_t_62 = __pyx_v_n;
      __pyx_t_63 = __pyx_v_n;
      __pyx_t_64 = 1;
      __pyx_t_65 = __pyx_v_m;
      __pyx_t_66 = 2;
      __pyx_t_67 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_64 * __pyx_v_J.strides[0]) ) + __pyx_t_65 * __pyx_v_J.strides[1]) ) + __pyx_t_66 * __pyx_v_J.strides[2]) ) + __pyx_t_67 * __pyx_v_J.strides[3]) )) = ((((((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_57 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_58 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_59 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_60 * __pyx_v_CM.strides[0]) ) + __pyx_t_61 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_62 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_63 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3734
 *                 J[1, m, 1, n] = alpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 2, n] = alpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[2, m, 1, n] = balpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[2, m, 2, n] = balpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *             J[1, m, 1, m] -= gIa[m]
 */
      __pyx_t_68 = __pyx_v_m;
      __pyx_t_69 = __pyx_v_m;
      __pyx_t_70 = __pyx_v_m;
      __pyx_t_71 = __pyx_v_m;
      __pyx_t_72 = __pyx_v_n;
      __pyx_t_73 = __pyx_v_n;
      __pyx_t_74 = 2;
      __pyx_t_75 = __pyx_v_m;
      __pyx_t_76 = 1;
      __pyx_t_77 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_74 * __pyx_v_J.strides[0]) ) + __pyx_t_75 * __pyx_v_J.strides[1]) ) + __pyx_t_76 * __pyx_v_J.strides[2]) ) + __pyx_t_77 * __pyx_v_J.strides[3]) )) = (((((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_68 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_69 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_70 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_71 * __pyx_v_CM.strides[0]) ) + __pyx_t_72 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_73 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3735
 *                 J[1, m, 2, n] = alpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[2, m, 1, n] = balpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[2, m, 2, n] = balpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *             J[1, m, 1, m] -= gIa[m]
 *             J[2, m, 2, m] -= gIs[m]
 */
      __pyx_t_78 = __pyx_v_m;
      __pyx_t_79 = __pyx_v_m;
      __pyx_t_80 = __pyx_v_m;
      __pyx_t_81 = __pyx_v_m;
      __pyx_t_82 = __pyx_v_n;
      __pyx_t_83 = __pyx_v_n;
      __pyx_t_84 = __pyx_v_n;
      __pyx_t_85 = 2;
      __pyx_t_86 = __pyx_v_m;
      __pyx_t_87 = 2;
      __pyx_t_88 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_85 * __pyx_v_J.strides[0]) ) + __pyx_t_86 * __pyx_v_J.strides[1]) ) + __pyx_t_87 * __pyx_v_J.strides[2]) ) + __pyx_t_88 * __pyx_v_J.strides[3]) )) = ((((((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_78 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_79 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_80 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_81 * __pyx_v_CM.strides[0]) ) + __pyx_t_82 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_83 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_84 * __pyx_v_fi.strides[0]) ))));
    }

    /* "pyross/inference.pyx":3736
 *                 J[2, m, 1, n] = balpha[m]*s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[2, m, 2, n] = balpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *             J[1, m, 1, m] -= gIa[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 2, m] -= gIs[m]
 *         self.J_mat = self.J.reshape((dim, dim))
 */
    __pyx_t_89 = __pyx_v_m;
    __pyx_t_90 = 1;
    __pyx_t_91 = __pyx_v_m;
    __pyx_t_92 = 1;
    __pyx_t_93 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_90 * __pyx_v_J.strides[0]) ) + __pyx_t_91 * __pyx_v_J.strides[1]) ) + __pyx_t_92 * __pyx_v_J.strides[2]) ) + __pyx_t_93 * __pyx_v_J.strides[3]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_89 * __pyx_v_gIa.strides[0]) )));

    /* "pyross/inference.pyx":3737
 *                 J[2, m, 2, n] = balpha[m]*s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *             J[1, m, 1, m] -= gIa[m]
 *             J[2, m, 2, m] -= gIs[m]             # <<<<<<<<<<<<<<
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 */
    __pyx_t_94 = __pyx_v_m;
    __pyx_t_95 = 2;
    __pyx_t_96 = __pyx_v_m;
    __pyx_t_97 = 2;
    __pyx_t_98 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_95 * __pyx_v_J.strides[0]) ) + __pyx_t_96 * __pyx_v_J.strides[1]) ) + __pyx_t_97 * __pyx_v_J.strides[2]) ) + __pyx_t_98 * __pyx_v_J.strides[3]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_94 * __pyx_v_gIs.strides[0]) )));
  }

  /* "pyross/inference.pyx":3738
 *             J[1, m, 1, m] -= gIa[m]
 *             J[2, m, 2, m] -= gIs[m]
 *         self.J_mat = self.J.reshape((dim, dim))             # <<<<<<<<<<<<<<
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] Ia, double [:] Is, double [:] l):
 */
  __pyx_t_99 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.J), __pyx_n_s_reshape); if (unlikely(!__pyx_t_99)) __PYX_ERR(0, 3738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_99);
  __pyx_t_100 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_100)) __PYX_ERR(0, 3738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_100);
  __pyx_t_101 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_101)) __PYX_ERR(0, 3738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_101);
  __pyx_t_102 = PyTuple_New(2); if (unlikely(!__pyx_t_102)) __PYX_ERR(0, 3738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_102);
  __Pyx_GIVEREF(__pyx_t_100);
  PyTuple_SET_ITEM(__pyx_t_102, 0, __pyx_t_100);
  __Pyx_GIVEREF(__pyx_t_101);
  PyTuple_SET_ITEM(__pyx_t_102, 1, __pyx_t_101);
  __pyx_t_100 = 0;
  __pyx_t_101 = 0;
  __pyx_t_101 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_99))) {
    __pyx_t_101 = PyMethod_GET_SELF(__pyx_t_99);
    if (likely(__pyx_t_101)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_99);
      __Pyx_INCREF(__pyx_t_101);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_99, function);
    }
  }
  __pyx_t_3 = (__pyx_t_101) ? __Pyx_PyObject_Call2Args(__pyx_t_99, __pyx_t_101, __pyx_t_102) : __Pyx_PyObject_CallOneArg(__pyx_t_99, __pyx_t_102);
  __Pyx_XDECREF(__pyx_t_101); __pyx_t_101 = 0;
  __Pyx_DECREF(__pyx_t_102); __pyx_t_102 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_99); __pyx_t_99 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3738, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __pyx_v_self->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3718
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_99);
  __Pyx_XDECREF(__pyx_t_100);
  __Pyx_XDECREF(__pyx_t_101);
  __Pyx_XDECREF(__pyx_t_102);
  __Pyx_AddTraceback("pyross.inference.SIR.jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3740
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

static PyObject *__pyx_f_6pyross_9inference_3SIR_noise_correlation(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_M;
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_B = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  PyObject *__pyx_t_45 = NULL;
  PyObject *__pyx_t_46 = NULL;
  PyObject *__pyx_t_47 = NULL;
  PyObject *__pyx_t_48 = NULL;
  __Pyx_RefNannySetupContext("noise_correlation", 0);

  /* "pyross/inference.pyx":3742
 *     cdef noise_correlation(self, double [:] s, double [:] Ia, double [:] Is, double [:] l):
 *         cdef:
 *             Py_ssize_t m, M=self.M             # <<<<<<<<<<<<<<
 *             double [:] gIa=self.gIa, gIs=self.gIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":3743
 *         cdef:
 *             Py_ssize_t m, M=self.M
 *             double [:] gIa=self.gIa, gIs=self.gIs             # <<<<<<<<<<<<<<
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3743, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3743, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3744
 *             Py_ssize_t m, M=self.M
 *             double [:] gIa=self.gIa, gIs=self.gIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3744, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_balpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3745
 *             double [:] gIa=self.gIa, gIs=self.gIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B             # <<<<<<<<<<<<<<
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.B), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3745, __pyx_L1_error)
  __pyx_v_B = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":3746
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - alpha[m]*l[m]*s[m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_5 = __pyx_t_1;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_m = __pyx_t_6;

    /* "pyross/inference.pyx":3747
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[0, m, 1, m] =  - alpha[m]*l[m]*s[m]
 *             B[1, m, 1, m] = alpha[m]*l[m]*s[m] + gIa[m]*Ia[m]
 */
    __pyx_t_7 = __pyx_v_m;
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_9 = 0;
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = 0;
    __pyx_t_12 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_9 * __pyx_v_B.strides[0]) ) + __pyx_t_10 * __pyx_v_B.strides[1]) ) + __pyx_t_11 * __pyx_v_B.strides[2]) ) + __pyx_t_12 * __pyx_v_B.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_7 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_8 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":3748
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - alpha[m]*l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 1, m] = alpha[m]*l[m]*s[m] + gIa[m]*Ia[m]
 *             B[0, m, 2, m] = - balpha[m]*l[m]*s[m]
 */
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_14 = __pyx_v_m;
    __pyx_t_15 = __pyx_v_m;
    __pyx_t_16 = 0;
    __pyx_t_17 = __pyx_v_m;
    __pyx_t_18 = 1;
    __pyx_t_19 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_16 * __pyx_v_B.strides[0]) ) + __pyx_t_17 * __pyx_v_B.strides[1]) ) + __pyx_t_18 * __pyx_v_B.strides[2]) ) + __pyx_t_19 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_13 * __pyx_v_alpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_14 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_15 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":3749
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - alpha[m]*l[m]*s[m]
 *             B[1, m, 1, m] = alpha[m]*l[m]*s[m] + gIa[m]*Ia[m]             # <<<<<<<<<<<<<<
 *             B[0, m, 2, m] = - balpha[m]*l[m]*s[m]
 *             B[2, m, 2, m] = balpha[m]*l[m]*s[m] + gIs[m]*Is[m]
 */
    __pyx_t_20 = __pyx_v_m;
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_22 = __pyx_v_m;
    __pyx_t_23 = __pyx_v_m;
    __pyx_t_24 = __pyx_v_m;
    __pyx_t_25 = 1;
    __pyx_t_26 = __pyx_v_m;
    __pyx_t_27 = 1;
    __pyx_t_28 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_25 * __pyx_v_B.strides[0]) ) + __pyx_t_26 * __pyx_v_B.strides[1]) ) + __pyx_t_27 * __pyx_v_B.strides[2]) ) + __pyx_t_28 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_20 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_21 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_22 * __pyx_v_s.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_23 * __pyx_v_gIa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_24 * __pyx_v_Ia.strides[0]) )))));

    /* "pyross/inference.pyx":3750
 *             B[0, m, 1, m] =  - alpha[m]*l[m]*s[m]
 *             B[1, m, 1, m] = alpha[m]*l[m]*s[m] + gIa[m]*Ia[m]
 *             B[0, m, 2, m] = - balpha[m]*l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 2, m] = balpha[m]*l[m]*s[m] + gIs[m]*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 */
    __pyx_t_29 = __pyx_v_m;
    __pyx_t_30 = __pyx_v_m;
    __pyx_t_31 = __pyx_v_m;
    __pyx_t_32 = 0;
    __pyx_t_33 = __pyx_v_m;
    __pyx_t_34 = 2;
    __pyx_t_35 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_32 * __pyx_v_B.strides[0]) ) + __pyx_t_33 * __pyx_v_B.strides[1]) ) + __pyx_t_34 * __pyx_v_B.strides[2]) ) + __pyx_t_35 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_29 * __pyx_v_balpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_30 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_31 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":3751
 *             B[1, m, 1, m] = alpha[m]*l[m]*s[m] + gIa[m]*Ia[m]
 *             B[0, m, 2, m] = - balpha[m]*l[m]*s[m]
 *             B[2, m, 2, m] = balpha[m]*l[m]*s[m] + gIs[m]*Is[m]             # <<<<<<<<<<<<<<
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 * 
 */
    __pyx_t_36 = __pyx_v_m;
    __pyx_t_37 = __pyx_v_m;
    __pyx_t_38 = __pyx_v_m;
    __pyx_t_39 = __pyx_v_m;
    __pyx_t_40 = __pyx_v_m;
    __pyx_t_41 = 2;
    __pyx_t_42 = __pyx_v_m;
    __pyx_t_43 = 2;
    __pyx_t_44 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_41 * __pyx_v_B.strides[0]) ) + __pyx_t_42 * __pyx_v_B.strides[1]) ) + __pyx_t_43 * __pyx_v_B.strides[2]) ) + __pyx_t_44 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_36 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_37 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_38 * __pyx_v_s.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_39 * __pyx_v_gIs.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_40 * __pyx_v_Is.strides[0]) )))));
  }

  /* "pyross/inference.pyx":3752
 *             B[0, m, 2, m] = - balpha[m]*l[m]*s[m]
 *             B[2, m, 2, m] = balpha[m]*l[m]*s[m] + gIs[m]*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __pyx_t_45 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.B), __pyx_n_s_reshape); if (unlikely(!__pyx_t_45)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_45);
  __pyx_t_46 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_46)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_46);
  __pyx_t_47 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_47)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_47);
  __pyx_t_48 = PyTuple_New(2); if (unlikely(!__pyx_t_48)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_48);
  __Pyx_GIVEREF(__pyx_t_46);
  PyTuple_SET_ITEM(__pyx_t_48, 0, __pyx_t_46);
  __Pyx_GIVEREF(__pyx_t_47);
  PyTuple_SET_ITEM(__pyx_t_48, 1, __pyx_t_47);
  __pyx_t_46 = 0;
  __pyx_t_47 = 0;
  __pyx_t_47 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_45))) {
    __pyx_t_47 = PyMethod_GET_SELF(__pyx_t_45);
    if (likely(__pyx_t_47)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_45);
      __Pyx_INCREF(__pyx_t_47);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_45, function);
    }
  }
  __pyx_t_3 = (__pyx_t_47) ? __Pyx_PyObject_Call2Args(__pyx_t_45, __pyx_t_47, __pyx_t_48) : __Pyx_PyObject_CallOneArg(__pyx_t_45, __pyx_t_48);
  __Pyx_XDECREF(__pyx_t_47); __pyx_t_47 = 0;
  __Pyx_DECREF(__pyx_t_48); __pyx_t_48 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_45); __pyx_t_45 = 0;
  __pyx_t_45 = PyTuple_New(2); if (unlikely(!__pyx_t_45)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_45);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_45, 0, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_45, 1, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __pyx_t_48 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_45); if (unlikely(!__pyx_t_48)) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_48);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_45); __pyx_t_45 = 0;
  if (!(likely(((__pyx_t_48) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_48, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3752, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_48);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __pyx_v_self->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_48);
  __pyx_t_48 = 0;

  /* "pyross/inference.pyx":3740
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_XDECREF(__pyx_t_45);
  __Pyx_XDECREF(__pyx_t_46);
  __Pyx_XDECREF(__pyx_t_47);
  __Pyx_XDECREF(__pyx_t_48);
  __Pyx_AddTraceback("pyross.inference.SIR.noise_correlation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_B, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3674
 *         relative tolerance for the Lyapunov-type integrator (default 1e-3)
 *     """
 *     cdef readonly pyross.deterministic.SIR det_model             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-4, rtol_lyapunov=1e-3):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3SIR_9det_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3SIR_9det_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR_9det_model___get__(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3SIR_9det_model___get__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_r = ((PyObject *)__pyx_v_self->det_model);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3SIR_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3SIR_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR_8__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3SIR_8__reduce_cython__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(35); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 16, ((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 17, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 18, ((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 26, __pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 27, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 28, __pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 29, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 30, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 33, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 34, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.contactMatrix != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.dsigmadt) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.fi) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices1) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices2) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.fsa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.gIa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.gIs) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.rows) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    __pyx_t_12 = __pyx_t_11;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SIR); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_239616695);
    __Pyx_GIVEREF(__pyx_int_239616695);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_239616695);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, None), state
 *     else:
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SIR__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SIR); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_239616695);
    __Pyx_GIVEREF(__pyx_int_239616695);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_239616695);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SIR.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SIR__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3SIR_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3SIR_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3SIR_10__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3SIR_10__setstate_cython__(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SIR__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SIR__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SIR, (type(self), 0xe4842b7, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SIR__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SIR.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3811
 *         readonly pyross.deterministic.SEIR det_model
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 4, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_4SEIR_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_4SEIR_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_1);
    values[4] = ((PyObject *)__pyx_int_4);
    values[5] = ((PyObject *)__pyx_n_u_LSODA);
    values[6] = ((PyObject *)__pyx_n_u_LSODA);
    values[7] = ((PyObject *)__pyx_float_1eneg_3);
    values[8] = ((PyObject *)__pyx_float_1eneg_3);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 1); __PYX_ERR(0, 3811, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 2); __PYX_ERR(0, 3811, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 3811, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parameters = values[0];
    __pyx_v_M = values[1];
    __pyx_v_fi = values[2];
    __pyx_v_Omega = values[3];
    __pyx_v_steps = values[4];
    __pyx_v_det_method = values[5];
    __pyx_v_lyapunov_method = values[6];
    __pyx_v_rtol_det = values[7];
    __pyx_v_rtol_lyapunov = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3811, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SEIR.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR___init__(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self), __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_4SEIR___init__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyross/inference.pyx":3812
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gIa', 'gIs', 'fsa']             # <<<<<<<<<<<<<<
 *         super().__init__(parameters, 4, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'E':1, 'Ia':2, 'Is':3}
 */
  __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_alpha);
  __Pyx_GIVEREF(__pyx_n_u_alpha);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_alpha);
  __Pyx_INCREF(__pyx_n_u_beta);
  __Pyx_GIVEREF(__pyx_n_u_beta);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_beta);
  __Pyx_INCREF(__pyx_n_u_gE);
  __Pyx_GIVEREF(__pyx_n_u_gE);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_gE);
  __Pyx_INCREF(__pyx_n_u_gIa);
  __Pyx_GIVEREF(__pyx_n_u_gIa);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_gIa);
  __Pyx_INCREF(__pyx_n_u_gIs);
  __Pyx_GIVEREF(__pyx_n_u_gIs);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_u_gIs);
  __Pyx_INCREF(__pyx_n_u_fsa);
  __Pyx_GIVEREF(__pyx_n_u_fsa);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_u_fsa);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.param_keys);
  __pyx_v_self->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3813
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 4, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)             # <<<<<<<<<<<<<<
 *         self.class_index_dict = {'S':0, 'E':1, 'Ia':2, 'Is':3}
 *         self.set_det_model(parameters)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEIR));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEIR));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SEIR));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_4, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3813, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_4, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3813, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_int_4);
    __Pyx_GIVEREF(__pyx_int_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_4);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_rtol_lyapunov);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3814
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 4, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'E':1, 'Ia':2, 'Is':3}             # <<<<<<<<<<<<<<
 *         self.set_det_model(parameters)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_S, __pyx_int_0) < 0) __PYX_ERR(0, 3814, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_E, __pyx_int_1) < 0) __PYX_ERR(0, 3814, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Ia, __pyx_int_2) < 0) __PYX_ERR(0, 3814, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Is, __pyx_int_3) < 0) __PYX_ERR(0, 3814, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.class_index_dict);
  __pyx_v_self->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3815
 *         super().__init__(parameters, 4, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'E':1, 'Ia':2, 'Is':3}
 *         self.set_det_model(parameters)             # <<<<<<<<<<<<<<
 * 
 *     def infection_indices(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3811
 *         readonly pyross.deterministic.SEIR det_model
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gIa', 'gIs', 'fsa']
 *         super().__init__(parameters, 4, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SEIR.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3817
 *         self.set_det_model(parameters)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return [1, 2, 3]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_2infection_indices(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_2infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("infection_indices", 0);

  /* "pyross/inference.pyx":3818
 * 
 *     def infection_indices(self):
 *         return [1, 2, 3]             # <<<<<<<<<<<<<<
 * 
 *     def set_params(self, parameters):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_2);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_3);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3817
 *         self.set_det_model(parameters)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return [1, 2, 3]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEIR.infection_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3820
 *         return [1, 2, 3]
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_params (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_4set_params(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_4set_params(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("set_params", 0);

  /* "pyross/inference.pyx":3821
 * 
 *     def set_params(self, parameters):
 *         super().set_params(parameters)             # <<<<<<<<<<<<<<
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEIR));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEIR));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SEIR));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_set_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3822
 *     def set_params(self, parameters):
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')             # <<<<<<<<<<<<<<
 * 
 *     def set_det_model(self, parameters):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_gE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_gE};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3822, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_gE};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3822, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_gE);
    __Pyx_GIVEREF(__pyx_n_u_gE);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_n_u_gE);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3822, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gE);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gE));
  __pyx_v_self->gE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3820
 *         return [1, 2, 3]
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SEIR.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3824
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SEIR(parameters, self.M, self.fi*self.Omega)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_7set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_7set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_6set_det_model(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_6set_det_model(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("set_det_model", 0);

  /* "pyross/inference.pyx":3825
 * 
 *     def set_det_model(self, parameters):
 *         self.det_model = pyross.deterministic.SEIR(parameters, self.M, self.fi*self.Omega)             # <<<<<<<<<<<<<<
 * 
 *     def make_params_dict(self):
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SEIR), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEIR *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3824
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SEIR(parameters, self.M, self.fi*self.Omega)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SEIR.set_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3827
 *         self.det_model = pyross.deterministic.SEIR(parameters, self.M, self.fi*self.Omega)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa,
 *                             'gIs':self.gIs, 'gE':self.gE, 'fsa':self.fsa}
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_9make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_9make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_8make_params_dict(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_8make_params_dict(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self) {
  PyObject *__pyx_v_parameters = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":3828
 * 
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa,             # <<<<<<<<<<<<<<
 *                             'gIs':self.gIs, 'gE':self.gE, 'fsa':self.fsa}
 *         return parameters
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_alpha, ((PyObject *)__pyx_v_self->__pyx_base.alpha)) < 0) __PYX_ERR(0, 3828, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_beta, ((PyObject *)__pyx_v_self->__pyx_base.beta)) < 0) __PYX_ERR(0, 3828, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIa, ((PyObject *)__pyx_v_self->__pyx_base.gIa)) < 0) __PYX_ERR(0, 3828, __pyx_L1_error)

  /* "pyross/inference.pyx":3829
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa,
 *                             'gIs':self.gIs, 'gE':self.gE, 'fsa':self.fsa}             # <<<<<<<<<<<<<<
 *         return parameters
 * 
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIs, ((PyObject *)__pyx_v_self->__pyx_base.gIs)) < 0) __PYX_ERR(0, 3828, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gE, ((PyObject *)__pyx_v_self->gE)) < 0) __PYX_ERR(0, 3828, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fsa, ((PyObject *)__pyx_v_self->__pyx_base.fsa)) < 0) __PYX_ERR(0, 3828, __pyx_L1_error)
  __pyx_v_parameters = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3830
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa,
 *                             'gIs':self.gIs, 'gE':self.gE, 'fsa':self.fsa}
 *         return parameters             # <<<<<<<<<<<<<<
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_parameters);
  __pyx_r = __pyx_v_parameters;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3827
 *         self.det_model = pyross.deterministic.SEIR(parameters, self.M, self.fi*self.Omega)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha, 'beta':self.beta, 'gIa':self.gIa,
 *                             'gIs':self.gIs, 'gE':self.gE, 'fsa':self.fsa}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEIR.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3832
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix *__pyx_optional_args) {

  /* "pyross/inference.pyx":3833
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                             b_matrix=True, jacobian=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] s, e, Ia, Is
 */
  PyObject *__pyx_v_b_matrix = ((PyObject *)Py_True);
  PyObject *__pyx_v_jacobian = ((PyObject *)Py_False);
  __Pyx_memviewslice __pyx_v_s = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_e = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Ia = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Is = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_M;
  __Pyx_memviewslice __pyx_v_l = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_b_matrix = __pyx_optional_args->b_matrix;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_jacobian = __pyx_optional_args->jacobian;
      }
    }
  }

  /* "pyross/inference.pyx":3836
 *         cdef:
 *             double [:] s, e, Ia, Is
 *             Py_ssize_t M=self.M             # <<<<<<<<<<<<<<
 *         s = x[0:M]
 *         e = x[M:2*M]
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":3837
 *             double [:] s, e, Ia, Is
 *             Py_ssize_t M=self.M
 *         s = x[0:M]             # <<<<<<<<<<<<<<
 *         e = x[M:2*M]
 *         Ia = x[2*M:3*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    0,
    __pyx_v_M,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3837, __pyx_L1_error)
}

__pyx_v_s = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3838
 *             Py_ssize_t M=self.M
 *         s = x[0:M]
 *         e = x[M:2*M]             # <<<<<<<<<<<<<<
 *         Ia = x[2*M:3*M]
 *         Is = x[3*M:4*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    __pyx_v_M,
    (2 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3838, __pyx_L1_error)
}

__pyx_v_e = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3839
 *         s = x[0:M]
 *         e = x[M:2*M]
 *         Ia = x[2*M:3*M]             # <<<<<<<<<<<<<<
 *         Is = x[3*M:4*M]
 *         self.CM = self.contactMatrix(t)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (2 * __pyx_v_M),
    (3 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3839, __pyx_L1_error)
}

__pyx_v_Ia = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3840
 *         e = x[M:2*M]
 *         Ia = x[2*M:3*M]
 *         Is = x[3*M:4*M]             # <<<<<<<<<<<<<<
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (3 * __pyx_v_M),
    (4 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 3840, __pyx_L1_error)
}

__pyx_v_Is = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3841
 *         Ia = x[2*M:3*M]
 *         Is = x[3*M:4*M]
 *         self.CM = self.contactMatrix(t)             # <<<<<<<<<<<<<<
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __pyx_t_6 = __pyx_v_self->__pyx_base.contactMatrix; __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3841, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __pyx_v_self->__pyx_base.CM = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":3842
 *         Is = x[3*M:4*M]
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_l = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3843
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)             # <<<<<<<<<<<<<<
 *         if b_matrix:
 *             self.noise_correlation(s, e, Ia, Is, l)
 */
  __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEIR *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_lambdas(__pyx_v_self, __pyx_v_Ia, __pyx_v_Is, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":3844
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, e, Ia, Is, l)
 *         if jacobian:
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_b_matrix); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3844, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":3845
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:
 *             self.noise_correlation(s, e, Ia, Is, l)             # <<<<<<<<<<<<<<
 *         if jacobian:
 *             self.jacobian(s, l)
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEIR *)__pyx_v_self->__pyx_base.__pyx_vtab)->noise_correlation(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_Ia, __pyx_v_Is, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3845, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3844
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, e, Ia, Is, l)
 *         if jacobian:
 */
  }

  /* "pyross/inference.pyx":3846
 *         if b_matrix:
 *             self.noise_correlation(s, e, Ia, Is, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, l)
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_jacobian); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3846, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":3847
 *             self.noise_correlation(s, e, Ia, Is, l)
 *         if jacobian:
 *             self.jacobian(s, l)             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEIR *)__pyx_v_self->__pyx_base.__pyx_vtab)->jacobian(__pyx_v_self, __pyx_v_s, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":3846
 *         if b_matrix:
 *             self.noise_correlation(s, e, Ia, Is, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, l)
 * 
 */
  }

  /* "pyross/inference.pyx":3832
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SEIR.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_s, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_e, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ia, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Is, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_l, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3849
 *             self.jacobian(s, l)
 * 
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

static PyObject *__pyx_f_6pyross_9inference_4SEIR_fill_lambdas(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l) {
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __Pyx_RefNannySetupContext("fill_lambdas", 0);

  /* "pyross/inference.pyx":3851
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):
 *         cdef:
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3851, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":3852
 *         cdef:
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3852, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3852, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3852, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3853
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             for n in range(M):
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_3;

  /* "pyross/inference.pyx":3854
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 */
  __pyx_t_3 = __pyx_v_M;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_m = __pyx_t_5;

    /* "pyross/inference.pyx":3855
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 * 
 */
    __pyx_t_6 = __pyx_v_M;
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_n = __pyx_t_8;

      /* "pyross/inference.pyx":3856
 *         for m in range(M):
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]             # <<<<<<<<<<<<<<
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):
 */
      __pyx_t_9 = __pyx_v_m;
      __pyx_t_10 = __pyx_v_m;
      __pyx_t_11 = __pyx_v_n;
      __pyx_t_12 = __pyx_v_n;
      __pyx_t_13 = __pyx_v_n;
      __pyx_t_14 = __pyx_v_n;
      __pyx_t_15 = __pyx_v_n;
      __pyx_t_16 = __pyx_v_m;
      *((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_16 * __pyx_v_l.strides[0]) )) += ((((*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_9 * __pyx_v_beta.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_10 * __pyx_v_CM.strides[0]) ) + __pyx_t_11 * __pyx_v_CM.strides[1]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_12 * __pyx_v_Ia.strides[0]) ))) + ((*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_13 * __pyx_v_fsa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_14 * __pyx_v_Is.strides[0]) )))))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_15 * __pyx_v_fi.strides[0]) ))));
    }
  }

  /* "pyross/inference.pyx":3849
 *             self.jacobian(s, l)
 * 
 *     cdef fill_lambdas(self, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_AddTraceback("pyross.inference.SEIR.fill_lambdas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3858
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

static PyObject *__pyx_f_6pyross_9inference_4SEIR_jacobian(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  PyObject *__pyx_t_86 = NULL;
  PyObject *__pyx_t_87 = NULL;
  PyObject *__pyx_t_88 = NULL;
  PyObject *__pyx_t_89 = NULL;
  __Pyx_RefNannySetupContext("jacobian", 0);

  /* "pyross/inference.pyx":3860
 *     cdef jacobian(self, double [:] s, double [:] l):
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim             # <<<<<<<<<<<<<<
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE, fsa=self.fsa, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":3861
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE, fsa=self.fsa, beta=self.beta             # <<<<<<<<<<<<<<
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3861, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3861, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3861, __pyx_L1_error)
  __pyx_v_gE = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3861, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3861, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3862
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE, fsa=self.fsa, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_balpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3863
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE, fsa=self.fsa, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.J), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3863, __pyx_L1_error)
  __pyx_v_J = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":3864
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 3864, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":3865
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_6 = __pyx_t_1;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_m = __pyx_t_7;

    /* "pyross/inference.pyx":3866
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m]
 */
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_9 = 0;
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = 0;
    __pyx_t_12 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_9 * __pyx_v_J.strides[0]) ) + __pyx_t_10 * __pyx_v_J.strides[1]) ) + __pyx_t_11 * __pyx_v_J.strides[2]) ) + __pyx_t_12 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_8 * __pyx_v_l.strides[0]) ))));

    /* "pyross/inference.pyx":3867
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 1, m] = - gE[m]
 *             J[2, m, 1, m] = alpha[m]*gE[m]
 */
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_14 = 1;
    __pyx_t_15 = __pyx_v_m;
    __pyx_t_16 = 0;
    __pyx_t_17 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_14 * __pyx_v_J.strides[0]) ) + __pyx_t_15 * __pyx_v_J.strides[1]) ) + __pyx_t_16 * __pyx_v_J.strides[2]) ) + __pyx_t_17 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_13 * __pyx_v_l.strides[0]) )));

    /* "pyross/inference.pyx":3868
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 1, m] = alpha[m]*gE[m]
 *             J[2, m, 2, m] = - gIa[m]
 */
    __pyx_t_18 = __pyx_v_m;
    __pyx_t_19 = 1;
    __pyx_t_20 = __pyx_v_m;
    __pyx_t_21 = 1;
    __pyx_t_22 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_19 * __pyx_v_J.strides[0]) ) + __pyx_t_20 * __pyx_v_J.strides[1]) ) + __pyx_t_21 * __pyx_v_J.strides[2]) ) + __pyx_t_22 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_18 * __pyx_v_gE.strides[0]) ))));

    /* "pyross/inference.pyx":3869
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m]
 *             J[2, m, 1, m] = alpha[m]*gE[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 2, m] = - gIa[m]
 *             J[3, m, 1, m] = balpha[m]*gE[m]
 */
    __pyx_t_23 = __pyx_v_m;
    __pyx_t_24 = __pyx_v_m;
    __pyx_t_25 = 2;
    __pyx_t_26 = __pyx_v_m;
    __pyx_t_27 = 1;
    __pyx_t_28 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_25 * __pyx_v_J.strides[0]) ) + __pyx_t_26 * __pyx_v_J.strides[1]) ) + __pyx_t_27 * __pyx_v_J.strides[2]) ) + __pyx_t_28 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_23 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_24 * __pyx_v_gE.strides[0]) ))));

    /* "pyross/inference.pyx":3870
 *             J[1, m, 1, m] = - gE[m]
 *             J[2, m, 1, m] = alpha[m]*gE[m]
 *             J[2, m, 2, m] = - gIa[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 1, m] = balpha[m]*gE[m]
 *             J[3, m, 3, m] = - gIs[m]
 */
    __pyx_t_29 = __pyx_v_m;
    __pyx_t_30 = 2;
    __pyx_t_31 = __pyx_v_m;
    __pyx_t_32 = 2;
    __pyx_t_33 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_30 * __pyx_v_J.strides[0]) ) + __pyx_t_31 * __pyx_v_J.strides[1]) ) + __pyx_t_32 * __pyx_v_J.strides[2]) ) + __pyx_t_33 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_29 * __pyx_v_gIa.strides[0]) ))));

    /* "pyross/inference.pyx":3871
 *             J[2, m, 1, m] = alpha[m]*gE[m]
 *             J[2, m, 2, m] = - gIa[m]
 *             J[3, m, 1, m] = balpha[m]*gE[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 3, m] = - gIs[m]
 *             for n in range(M):
 */
    __pyx_t_34 = __pyx_v_m;
    __pyx_t_35 = __pyx_v_m;
    __pyx_t_36 = 3;
    __pyx_t_37 = __pyx_v_m;
    __pyx_t_38 = 1;
    __pyx_t_39 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_36 * __pyx_v_J.strides[0]) ) + __pyx_t_37 * __pyx_v_J.strides[1]) ) + __pyx_t_38 * __pyx_v_J.strides[2]) ) + __pyx_t_39 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_34 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_35 * __pyx_v_gE.strides[0]) ))));

    /* "pyross/inference.pyx":3872
 *             J[2, m, 2, m] = - gIa[m]
 *             J[3, m, 1, m] = balpha[m]*gE[m]
 *             J[3, m, 3, m] = - gIs[m]             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 */
    __pyx_t_40 = __pyx_v_m;
    __pyx_t_41 = 3;
    __pyx_t_42 = __pyx_v_m;
    __pyx_t_43 = 3;
    __pyx_t_44 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_41 * __pyx_v_J.strides[0]) ) + __pyx_t_42 * __pyx_v_J.strides[1]) ) + __pyx_t_43 * __pyx_v_J.strides[2]) ) + __pyx_t_44 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_40 * __pyx_v_gIs.strides[0]) ))));

    /* "pyross/inference.pyx":3873
 *             J[3, m, 1, m] = balpha[m]*gE[m]
 *             J[3, m, 3, m] = - gIs[m]
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
    __pyx_t_45 = __pyx_v_M;
    __pyx_t_46 = __pyx_t_45;
    for (__pyx_t_47 = 0; __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) {
      __pyx_v_n = __pyx_t_47;

      /* "pyross/inference.pyx":3874
 *             J[3, m, 3, m] = - gIs[m]
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_48 = __pyx_v_m;
      __pyx_t_49 = __pyx_v_m;
      __pyx_t_50 = __pyx_v_m;
      __pyx_t_51 = __pyx_v_n;
      __pyx_t_52 = __pyx_v_n;
      __pyx_t_53 = 0;
      __pyx_t_54 = __pyx_v_m;
      __pyx_t_55 = 2;
      __pyx_t_56 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_53 * __pyx_v_J.strides[0]) ) + __pyx_t_54 * __pyx_v_J.strides[1]) ) + __pyx_t_55 * __pyx_v_J.strides[2]) ) + __pyx_t_56 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_48 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_49 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_50 * __pyx_v_CM.strides[0]) ) + __pyx_t_51 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_52 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3875
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_57 = __pyx_v_m;
      __pyx_t_58 = __pyx_v_m;
      __pyx_t_59 = __pyx_v_m;
      __pyx_t_60 = __pyx_v_n;
      __pyx_t_61 = __pyx_v_n;
      __pyx_t_62 = __pyx_v_n;
      __pyx_t_63 = 0;
      __pyx_t_64 = __pyx_v_m;
      __pyx_t_65 = 3;
      __pyx_t_66 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_63 * __pyx_v_J.strides[0]) ) + __pyx_t_64 * __pyx_v_J.strides[1]) ) + __pyx_t_65 * __pyx_v_J.strides[2]) ) + __pyx_t_66 * __pyx_v_J.strides[3]) )) = (((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_57 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_58 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_59 * __pyx_v_CM.strides[0]) ) + __pyx_t_60 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_61 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_62 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3876
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *         self.J_mat = self.J.reshape((dim, dim))
 */
      __pyx_t_67 = __pyx_v_m;
      __pyx_t_68 = __pyx_v_m;
      __pyx_t_69 = __pyx_v_m;
      __pyx_t_70 = __pyx_v_n;
      __pyx_t_71 = __pyx_v_n;
      __pyx_t_72 = 1;
      __pyx_t_73 = __pyx_v_m;
      __pyx_t_74 = 2;
      __pyx_t_75 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_72 * __pyx_v_J.strides[0]) ) + __pyx_t_73 * __pyx_v_J.strides[1]) ) + __pyx_t_74 * __pyx_v_J.strides[2]) ) + __pyx_t_75 * __pyx_v_J.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_67 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_68 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_69 * __pyx_v_CM.strides[0]) ) + __pyx_t_70 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_71 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":3877
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 */
      __pyx_t_76 = __pyx_v_m;
      __pyx_t_77 = __pyx_v_m;
      __pyx_t_78 = __pyx_v_m;
      __pyx_t_79 = __pyx_v_n;
      __pyx_t_80 = __pyx_v_n;
      __pyx_t_81 = __pyx_v_n;
      __pyx_t_82 = 1;
      __pyx_t_83 = __pyx_v_m;
      __pyx_t_84 = 3;
      __pyx_t_85 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_82 * __pyx_v_J.strides[0]) ) + __pyx_t_83 * __pyx_v_J.strides[1]) ) + __pyx_t_84 * __pyx_v_J.strides[2]) ) + __pyx_t_85 * __pyx_v_J.strides[3]) )) = (((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_76 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_77 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_78 * __pyx_v_CM.strides[0]) ) + __pyx_t_79 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_80 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_81 * __pyx_v_fi.strides[0]) ))));
    }
  }

  /* "pyross/inference.pyx":3878
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *         self.J_mat = self.J.reshape((dim, dim))             # <<<<<<<<<<<<<<
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] Ia, double [:] Is, double [:] l):
 */
  __pyx_t_86 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.J), __pyx_n_s_reshape); if (unlikely(!__pyx_t_86)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_86);
  __pyx_t_87 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_87)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_87);
  __pyx_t_88 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_88)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_88);
  __pyx_t_89 = PyTuple_New(2); if (unlikely(!__pyx_t_89)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_89);
  __Pyx_GIVEREF(__pyx_t_87);
  PyTuple_SET_ITEM(__pyx_t_89, 0, __pyx_t_87);
  __Pyx_GIVEREF(__pyx_t_88);
  PyTuple_SET_ITEM(__pyx_t_89, 1, __pyx_t_88);
  __pyx_t_87 = 0;
  __pyx_t_88 = 0;
  __pyx_t_88 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_86))) {
    __pyx_t_88 = PyMethod_GET_SELF(__pyx_t_86);
    if (likely(__pyx_t_88)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_86);
      __Pyx_INCREF(__pyx_t_88);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_86, function);
    }
  }
  __pyx_t_3 = (__pyx_t_88) ? __Pyx_PyObject_Call2Args(__pyx_t_86, __pyx_t_88, __pyx_t_89) : __Pyx_PyObject_CallOneArg(__pyx_t_86, __pyx_t_89);
  __Pyx_XDECREF(__pyx_t_88); __pyx_t_88 = 0;
  __Pyx_DECREF(__pyx_t_89); __pyx_t_89 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_86); __pyx_t_86 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __pyx_v_self->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3858
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_86);
  __Pyx_XDECREF(__pyx_t_87);
  __Pyx_XDECREF(__pyx_t_88);
  __Pyx_XDECREF(__pyx_t_89);
  __Pyx_AddTraceback("pyross.inference.SEIR.jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3880
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

static PyObject *__pyx_f_6pyross_9inference_4SEIR_noise_correlation(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_M;
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_B = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  PyObject *__pyx_t_59 = NULL;
  PyObject *__pyx_t_60 = NULL;
  PyObject *__pyx_t_61 = NULL;
  PyObject *__pyx_t_62 = NULL;
  __Pyx_RefNannySetupContext("noise_correlation", 0);

  /* "pyross/inference.pyx":3882
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] Ia, double [:] Is, double [:] l):
 *         cdef:
 *             Py_ssize_t m, M=self.M             # <<<<<<<<<<<<<<
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":3883
 *         cdef:
 *             Py_ssize_t m, M=self.M
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE             # <<<<<<<<<<<<<<
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3883, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3883, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3883, __pyx_L1_error)
  __pyx_v_gE = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3884
 *             Py_ssize_t m, M=self.M
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE
 *             double [:] alpha=self.alpha, balpha=1-self.alpha             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3884, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 3884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_balpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":3885
 *             double [:] gIa=self.gIa, gIs=self.gIs, gE=self.gE
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B             # <<<<<<<<<<<<<<
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.B), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3885, __pyx_L1_error)
  __pyx_v_B = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":3886
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_5 = __pyx_t_1;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_m = __pyx_t_6;

    /* "pyross/inference.pyx":3887
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + gE[m]*e[m]
 */
    __pyx_t_7 = __pyx_v_m;
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_9 = 0;
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = 0;
    __pyx_t_12 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_9 * __pyx_v_B.strides[0]) ) + __pyx_t_10 * __pyx_v_B.strides[1]) ) + __pyx_t_11 * __pyx_v_B.strides[2]) ) + __pyx_t_12 * __pyx_v_B.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_7 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_8 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":3888
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 1, m] = l[m]*s[m] + gE[m]*e[m]
 *             B[1, m, 2, m] = -alpha[m]*gE[m]*e[m]
 */
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_14 = __pyx_v_m;
    __pyx_t_15 = 0;
    __pyx_t_16 = __pyx_v_m;
    __pyx_t_17 = 1;
    __pyx_t_18 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_15 * __pyx_v_B.strides[0]) ) + __pyx_t_16 * __pyx_v_B.strides[1]) ) + __pyx_t_17 * __pyx_v_B.strides[2]) ) + __pyx_t_18 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_13 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_14 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":3889
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + gE[m]*e[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 2, m] = -alpha[m]*gE[m]*e[m]
 *             B[1, m, 3, m] = -balpha[m]*gE[m]*e[m]
 */
    __pyx_t_19 = __pyx_v_m;
    __pyx_t_20 = __pyx_v_m;
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_22 = __pyx_v_m;
    __pyx_t_23 = 1;
    __pyx_t_24 = __pyx_v_m;
    __pyx_t_25 = 1;
    __pyx_t_26 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_23 * __pyx_v_B.strides[0]) ) + __pyx_t_24 * __pyx_v_B.strides[1]) ) + __pyx_t_25 * __pyx_v_B.strides[2]) ) + __pyx_t_26 * __pyx_v_B.strides[3]) )) = (((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_19 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_20 * __pyx_v_s.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_21 * __pyx_v_gE.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_22 * __pyx_v_e.strides[0]) )))));

    /* "pyross/inference.pyx":3890
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + gE[m]*e[m]
 *             B[1, m, 2, m] = -alpha[m]*gE[m]*e[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 3, m] = -balpha[m]*gE[m]*e[m]
 *             B[2, m, 2, m] = alpha[m]*gE[m]*e[m]+gIa[m]*Ia[m]
 */
    __pyx_t_27 = __pyx_v_m;
    __pyx_t_28 = __pyx_v_m;
    __pyx_t_29 = __pyx_v_m;
    __pyx_t_30 = 1;
    __pyx_t_31 = __pyx_v_m;
    __pyx_t_32 = 2;
    __pyx_t_33 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_30 * __pyx_v_B.strides[0]) ) + __pyx_t_31 * __pyx_v_B.strides[1]) ) + __pyx_t_32 * __pyx_v_B.strides[2]) ) + __pyx_t_33 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_27 * __pyx_v_alpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_28 * __pyx_v_gE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_29 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":3891
 *             B[1, m, 1, m] = l[m]*s[m] + gE[m]*e[m]
 *             B[1, m, 2, m] = -alpha[m]*gE[m]*e[m]
 *             B[1, m, 3, m] = -balpha[m]*gE[m]*e[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 2, m] = alpha[m]*gE[m]*e[m]+gIa[m]*Ia[m]
 *             B[3, m, 3, m] = balpha[m]*gE[m]*e[m]+gIs[m]*Is[m]
 */
    __pyx_t_34 = __pyx_v_m;
    __pyx_t_35 = __pyx_v_m;
    __pyx_t_36 = __pyx_v_m;
    __pyx_t_37 = 1;
    __pyx_t_38 = __pyx_v_m;
    __pyx_t_39 = 3;
    __pyx_t_40 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_37 * __pyx_v_B.strides[0]) ) + __pyx_t_38 * __pyx_v_B.strides[1]) ) + __pyx_t_39 * __pyx_v_B.strides[2]) ) + __pyx_t_40 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_34 * __pyx_v_balpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_35 * __pyx_v_gE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_36 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":3892
 *             B[1, m, 2, m] = -alpha[m]*gE[m]*e[m]
 *             B[1, m, 3, m] = -balpha[m]*gE[m]*e[m]
 *             B[2, m, 2, m] = alpha[m]*gE[m]*e[m]+gIa[m]*Ia[m]             # <<<<<<<<<<<<<<
 *             B[3, m, 3, m] = balpha[m]*gE[m]*e[m]+gIs[m]*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 */
    __pyx_t_41 = __pyx_v_m;
    __pyx_t_42 = __pyx_v_m;
    __pyx_t_43 = __pyx_v_m;
    __pyx_t_44 = __pyx_v_m;
    __pyx_t_45 = __pyx_v_m;
    __pyx_t_46 = 2;
    __pyx_t_47 = __pyx_v_m;
    __pyx_t_48 = 2;
    __pyx_t_49 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_46 * __pyx_v_B.strides[0]) ) + __pyx_t_47 * __pyx_v_B.strides[1]) ) + __pyx_t_48 * __pyx_v_B.strides[2]) ) + __pyx_t_49 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_41 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_42 * __pyx_v_gE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_43 * __pyx_v_e.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_44 * __pyx_v_gIa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_45 * __pyx_v_Ia.strides[0]) )))));

    /* "pyross/inference.pyx":3893
 *             B[1, m, 3, m] = -balpha[m]*gE[m]*e[m]
 *             B[2, m, 2, m] = alpha[m]*gE[m]*e[m]+gIa[m]*Ia[m]
 *             B[3, m, 3, m] = balpha[m]*gE[m]*e[m]+gIs[m]*Is[m]             # <<<<<<<<<<<<<<
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 * 
 */
    __pyx_t_50 = __pyx_v_m;
    __pyx_t_51 = __pyx_v_m;
    __pyx_t_52 = __pyx_v_m;
    __pyx_t_53 = __pyx_v_m;
    __pyx_t_54 = __pyx_v_m;
    __pyx_t_55 = 3;
    __pyx_t_56 = __pyx_v_m;
    __pyx_t_57 = 3;
    __pyx_t_58 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_55 * __pyx_v_B.strides[0]) ) + __pyx_t_56 * __pyx_v_B.strides[1]) ) + __pyx_t_57 * __pyx_v_B.strides[2]) ) + __pyx_t_58 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_50 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_51 * __pyx_v_gE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_52 * __pyx_v_e.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_53 * __pyx_v_gIs.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_54 * __pyx_v_Is.strides[0]) )))));
  }

  /* "pyross/inference.pyx":3894
 *             B[2, m, 2, m] = alpha[m]*gE[m]*e[m]+gIa[m]*Ia[m]
 *             B[3, m, 3, m] = balpha[m]*gE[m]*e[m]+gIs[m]*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_59 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.B), __pyx_n_s_reshape); if (unlikely(!__pyx_t_59)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_59);
  __pyx_t_60 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_60)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_60);
  __pyx_t_61 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_61)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_61);
  __pyx_t_62 = PyTuple_New(2); if (unlikely(!__pyx_t_62)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_62);
  __Pyx_GIVEREF(__pyx_t_60);
  PyTuple_SET_ITEM(__pyx_t_62, 0, __pyx_t_60);
  __Pyx_GIVEREF(__pyx_t_61);
  PyTuple_SET_ITEM(__pyx_t_62, 1, __pyx_t_61);
  __pyx_t_60 = 0;
  __pyx_t_61 = 0;
  __pyx_t_61 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_59))) {
    __pyx_t_61 = PyMethod_GET_SELF(__pyx_t_59);
    if (likely(__pyx_t_61)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_59);
      __Pyx_INCREF(__pyx_t_61);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_59, function);
    }
  }
  __pyx_t_3 = (__pyx_t_61) ? __Pyx_PyObject_Call2Args(__pyx_t_59, __pyx_t_61, __pyx_t_62) : __Pyx_PyObject_CallOneArg(__pyx_t_59, __pyx_t_62);
  __Pyx_XDECREF(__pyx_t_61); __pyx_t_61 = 0;
  __Pyx_DECREF(__pyx_t_62); __pyx_t_62 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_59); __pyx_t_59 = 0;
  __pyx_t_59 = PyTuple_New(2); if (unlikely(!__pyx_t_59)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_59);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_59, 0, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_59, 1, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __pyx_t_62 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_59); if (unlikely(!__pyx_t_62)) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_62);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_59); __pyx_t_59 = 0;
  if (!(likely(((__pyx_t_62) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_62, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3894, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_62);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __pyx_v_self->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_62);
  __pyx_t_62 = 0;

  /* "pyross/inference.pyx":3880
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_XDECREF(__pyx_t_59);
  __Pyx_XDECREF(__pyx_t_60);
  __Pyx_XDECREF(__pyx_t_61);
  __Pyx_XDECREF(__pyx_t_62);
  __Pyx_AddTraceback("pyross.inference.SEIR.noise_correlation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_B, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3808
 * 
 *     cdef:
 *         readonly np.ndarray gE             # <<<<<<<<<<<<<<
 *         readonly pyross.deterministic.SEIR det_model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_2gE_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_2gE_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_2gE___get__(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_2gE___get__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gE));
  __pyx_r = ((PyObject *)__pyx_v_self->gE);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3809
 *     cdef:
 *         readonly np.ndarray gE
 *         readonly pyross.deterministic.SEIR det_model             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_9det_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_9det_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_9det_model___get__(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_9det_model___get__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_r = ((PyObject *)__pyx_v_self->det_model);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_10__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_10__reduce_cython__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(36); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 16, ((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 17, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 18, ((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gE));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gE));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->gE));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 26, ((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 27, __pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 28, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 29, __pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 30, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 31, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 33, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 34, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 35, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.contactMatrix != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.dsigmadt) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.fi) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices1) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices2) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.fsa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->gE) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.gIa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.gIs) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.rows) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SEIR); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_230868175);
    __Pyx_GIVEREF(__pyx_int_230868175);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_230868175);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, None), state
 *     else:
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SEIR__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SEIR); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_230868175);
    __Pyx_GIVEREF(__pyx_int_230868175);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_230868175);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SEIR.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SEIR__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SEIR_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SEIR_12__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SEIR_12__setstate_cython__(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SEIR__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SEIR__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SEIR, (type(self), 0xdc2c4cf, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SEIR__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEIR.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3967
 *         readonly pyross.deterministic.SEAIRQ det_model
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gA', \
 *                            'gIa', 'gIs', 'fsa', \
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_6SEAIRQ_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_6SEAIRQ_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_1);
    values[4] = ((PyObject *)__pyx_int_4);
    values[5] = ((PyObject *)__pyx_n_u_LSODA);
    values[6] = ((PyObject *)__pyx_n_u_LSODA);
    values[7] = ((PyObject *)__pyx_float_1eneg_3);
    values[8] = ((PyObject *)__pyx_float_1eneg_3);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 1); __PYX_ERR(0, 3967, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 2); __PYX_ERR(0, 3967, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 3967, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parameters = values[0];
    __pyx_v_M = values[1];
    __pyx_v_fi = values[2];
    __pyx_v_Omega = values[3];
    __pyx_v_steps = values[4];
    __pyx_v_det_method = values[5];
    __pyx_v_lyapunov_method = values[6];
    __pyx_v_rtol_det = values[7];
    __pyx_v_rtol_lyapunov = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3967, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ___init__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self), __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_6SEAIRQ___init__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyross/inference.pyx":3968
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gA', \             # <<<<<<<<<<<<<<
 *                            'gIa', 'gIs', 'fsa', \
 *                            'tE', 'tA', 'tIa', 'tIs']
 */
  __pyx_t_1 = PyList_New(11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_alpha);
  __Pyx_GIVEREF(__pyx_n_u_alpha);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_alpha);
  __Pyx_INCREF(__pyx_n_u_beta);
  __Pyx_GIVEREF(__pyx_n_u_beta);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_beta);
  __Pyx_INCREF(__pyx_n_u_gE);
  __Pyx_GIVEREF(__pyx_n_u_gE);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_gE);
  __Pyx_INCREF(__pyx_n_u_gA);
  __Pyx_GIVEREF(__pyx_n_u_gA);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_gA);
  __Pyx_INCREF(__pyx_n_u_gIa);
  __Pyx_GIVEREF(__pyx_n_u_gIa);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_u_gIa);
  __Pyx_INCREF(__pyx_n_u_gIs);
  __Pyx_GIVEREF(__pyx_n_u_gIs);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_u_gIs);
  __Pyx_INCREF(__pyx_n_u_fsa);
  __Pyx_GIVEREF(__pyx_n_u_fsa);
  PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_u_fsa);
  __Pyx_INCREF(__pyx_n_u_tE);
  __Pyx_GIVEREF(__pyx_n_u_tE);
  PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_u_tE);
  __Pyx_INCREF(__pyx_n_u_tA);
  __Pyx_GIVEREF(__pyx_n_u_tA);
  PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_u_tA);
  __Pyx_INCREF(__pyx_n_u_tIa);
  __Pyx_GIVEREF(__pyx_n_u_tIa);
  PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_u_tIa);
  __Pyx_INCREF(__pyx_n_u_tIs);
  __Pyx_GIVEREF(__pyx_n_u_tIs);
  PyList_SET_ITEM(__pyx_t_1, 10, __pyx_n_u_tIs);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.param_keys);
  __pyx_v_self->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3971
 *                            'gIa', 'gIs', 'fsa', \
 *                            'tE', 'tA', 'tIa', 'tIs']
 *         super().__init__(parameters, 6, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)             # <<<<<<<<<<<<<<
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}
 *         self.set_det_model(parameters)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_6, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3971, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_6, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3971, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_int_6);
    __Pyx_GIVEREF(__pyx_int_6);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_6);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_rtol_lyapunov);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3972
 *                            'tE', 'tA', 'tIa', 'tIs']
 *         super().__init__(parameters, 6, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}             # <<<<<<<<<<<<<<
 *         self.set_det_model(parameters)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_S, __pyx_int_0) < 0) __PYX_ERR(0, 3972, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_E, __pyx_int_1) < 0) __PYX_ERR(0, 3972, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_A, __pyx_int_2) < 0) __PYX_ERR(0, 3972, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Ia, __pyx_int_3) < 0) __PYX_ERR(0, 3972, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Is, __pyx_int_4) < 0) __PYX_ERR(0, 3972, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Q, __pyx_int_5) < 0) __PYX_ERR(0, 3972, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.class_index_dict);
  __pyx_v_self->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3973
 *         super().__init__(parameters, 6, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}
 *         self.set_det_model(parameters)             # <<<<<<<<<<<<<<
 * 
 *     def infection_indices(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3967
 *         readonly pyross.deterministic.SEAIRQ det_model
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gA', \
 *                            'gIa', 'gIs', 'fsa', \
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3975
 *         self.set_det_model(parameters)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return [1, 2, 3, 4]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_2infection_indices(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("infection_indices", 0);

  /* "pyross/inference.pyx":3976
 * 
 *     def infection_indices(self):
 *         return [1, 2, 3, 4]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_2);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_3);
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_int_4);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3975
 *         self.set_det_model(parameters)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return [1, 2, 3, 4]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.infection_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3979
 * 
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SEAIRQ(parameters, self.M, self.fi*self.Omega)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_5set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_5set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_4set_det_model(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_4set_det_model(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("set_det_model", 0);

  /* "pyross/inference.pyx":3980
 * 
 *     def set_det_model(self, parameters):
 *         self.det_model = pyross.deterministic.SEAIRQ(parameters, self.M, self.fi*self.Omega)             # <<<<<<<<<<<<<<
 * 
 *     def make_params_dict(self):
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SEAIRQ), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":3979
 * 
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SEAIRQ(parameters, self.M, self.fi*self.Omega)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.set_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3982
 *         self.det_model = pyross.deterministic.SEAIRQ(parameters, self.M, self.fi*self.Omega)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_7make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_7make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_6make_params_dict(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_6make_params_dict(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_v_parameters = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":3983
 * 
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha,             # <<<<<<<<<<<<<<
 *                       'beta':self.beta,
 *                       'gIa':self.gIa,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_alpha, ((PyObject *)__pyx_v_self->__pyx_base.alpha)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3984
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,             # <<<<<<<<<<<<<<
 *                       'gIa':self.gIa,
 *                       'gIs':self.gIs,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_beta, ((PyObject *)__pyx_v_self->__pyx_base.beta)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3985
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,
 *                       'gIa':self.gIa,             # <<<<<<<<<<<<<<
 *                       'gIs':self.gIs,
 *                       'gE':self.gE,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIa, ((PyObject *)__pyx_v_self->__pyx_base.gIa)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3986
 *                       'beta':self.beta,
 *                       'gIa':self.gIa,
 *                       'gIs':self.gIs,             # <<<<<<<<<<<<<<
 *                       'gE':self.gE,
 *                       'gA':self.gA,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIs, ((PyObject *)__pyx_v_self->__pyx_base.gIs)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3987
 *                       'gIa':self.gIa,
 *                       'gIs':self.gIs,
 *                       'gE':self.gE,             # <<<<<<<<<<<<<<
 *                       'gA':self.gA,
 *                       'fsa': self.fsa,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gE, ((PyObject *)__pyx_v_self->gE)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3988
 *                       'gIs':self.gIs,
 *                       'gE':self.gE,
 *                       'gA':self.gA,             # <<<<<<<<<<<<<<
 *                       'fsa': self.fsa,
 *                       'tS': 0,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gA, ((PyObject *)__pyx_v_self->gA)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3989
 *                       'gE':self.gE,
 *                       'gA':self.gA,
 *                       'fsa': self.fsa,             # <<<<<<<<<<<<<<
 *                       'tS': 0,
 *                       'tE': self.tE,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fsa, ((PyObject *)__pyx_v_self->__pyx_base.fsa)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tS, __pyx_int_0) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3991
 *                       'fsa': self.fsa,
 *                       'tS': 0,
 *                       'tE': self.tE,             # <<<<<<<<<<<<<<
 *                       'tA': self.tA,
 *                       'tIa': self.tIa,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tE, ((PyObject *)__pyx_v_self->tE)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3992
 *                       'tS': 0,
 *                       'tE': self.tE,
 *                       'tA': self.tA,             # <<<<<<<<<<<<<<
 *                       'tIa': self.tIa,
 *                       'tIs': self.tIs
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tA, ((PyObject *)__pyx_v_self->tA)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3993
 *                       'tE': self.tE,
 *                       'tA': self.tA,
 *                       'tIa': self.tIa,             # <<<<<<<<<<<<<<
 *                       'tIs': self.tIs
 *                       }
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tIa, ((PyObject *)__pyx_v_self->tIa)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)

  /* "pyross/inference.pyx":3994
 *                       'tA': self.tA,
 *                       'tIa': self.tIa,
 *                       'tIs': self.tIs             # <<<<<<<<<<<<<<
 *                       }
 *         return parameters
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tIs, ((PyObject *)__pyx_v_self->tIs)) < 0) __PYX_ERR(0, 3983, __pyx_L1_error)
  __pyx_v_parameters = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3996
 *                       'tIs': self.tIs
 *                       }
 *         return parameters             # <<<<<<<<<<<<<<
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_parameters);
  __pyx_r = __pyx_v_parameters;
  goto __pyx_L0;

  /* "pyross/inference.pyx":3982
 *         self.det_model = pyross.deterministic.SEAIRQ(parameters, self.M, self.fi*self.Omega)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3998
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix *__pyx_optional_args) {

  /* "pyross/inference.pyx":3999
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                         b_matrix=True, jacobian=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] s, e, a, Ia, Is, Q
 */
  PyObject *__pyx_v_b_matrix = ((PyObject *)Py_True);
  PyObject *__pyx_v_jacobian = ((PyObject *)Py_False);
  __Pyx_memviewslice __pyx_v_s = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_e = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_a = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Ia = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Is = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_v_q = NULL;
  __Pyx_memviewslice __pyx_v_l = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_b_matrix = __pyx_optional_args->b_matrix;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_jacobian = __pyx_optional_args->jacobian;
      }
    }
  }

  /* "pyross/inference.pyx":4002
 *         cdef:
 *             double [:] s, e, a, Ia, Is, Q
 *             Py_ssize_t M=self.M             # <<<<<<<<<<<<<<
 *         s = x[0:M]
 *         e = x[M:2*M]
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":4003
 *             double [:] s, e, a, Ia, Is, Q
 *             Py_ssize_t M=self.M
 *         s = x[0:M]             # <<<<<<<<<<<<<<
 *         e = x[M:2*M]
 *         a = x[2*M:3*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    0,
    __pyx_v_M,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4003, __pyx_L1_error)
}

__pyx_v_s = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4004
 *             Py_ssize_t M=self.M
 *         s = x[0:M]
 *         e = x[M:2*M]             # <<<<<<<<<<<<<<
 *         a = x[2*M:3*M]
 *         Ia = x[3*M:4*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    __pyx_v_M,
    (2 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4004, __pyx_L1_error)
}

__pyx_v_e = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4005
 *         s = x[0:M]
 *         e = x[M:2*M]
 *         a = x[2*M:3*M]             # <<<<<<<<<<<<<<
 *         Ia = x[3*M:4*M]
 *         Is = x[4*M:5*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (2 * __pyx_v_M),
    (3 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4005, __pyx_L1_error)
}

__pyx_v_a = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4006
 *         e = x[M:2*M]
 *         a = x[2*M:3*M]
 *         Ia = x[3*M:4*M]             # <<<<<<<<<<<<<<
 *         Is = x[4*M:5*M]
 *         q = x[5*M:6*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (3 * __pyx_v_M),
    (4 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4006, __pyx_L1_error)
}

__pyx_v_Ia = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4007
 *         a = x[2*M:3*M]
 *         Ia = x[3*M:4*M]
 *         Is = x[4*M:5*M]             # <<<<<<<<<<<<<<
 *         q = x[5*M:6*M]
 *         self.CM = self.contactMatrix(t)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (4 * __pyx_v_M),
    (5 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4007, __pyx_L1_error)
}

__pyx_v_Is = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4008
 *         Ia = x[3*M:4*M]
 *         Is = x[4*M:5*M]
 *         q = x[5*M:6*M]             # <<<<<<<<<<<<<<
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (5 * __pyx_v_M),
    (6 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4008, __pyx_L1_error)
}

__pyx_t_4 = __pyx_memoryview_fromslice(__pyx_t_2, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_v_q = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4009
 *         Is = x[4*M:5*M]
 *         q = x[5*M:6*M]
 *         self.CM = self.contactMatrix(t)             # <<<<<<<<<<<<<<
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __pyx_t_6 = __pyx_v_self->__pyx_base.contactMatrix; __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4009, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __pyx_v_self->__pyx_base.CM = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4010
 *         q = x[5*M:6*M]
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4010, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_l = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4011
 *         self.CM = self.contactMatrix(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)             # <<<<<<<<<<<<<<
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)
 */
  __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_lambdas(__pyx_v_self, __pyx_v_a, __pyx_v_Ia, __pyx_v_Is, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":4012
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)
 *         if jacobian:
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_b_matrix); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4012, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":4013
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)             # <<<<<<<<<<<<<<
 *         if jacobian:
 *             self.jacobian(s, l)
 */
    __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_q, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4013, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ *)__pyx_v_self->__pyx_base.__pyx_vtab)->noise_correlation(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_a, __pyx_v_Ia, __pyx_v_Is, __pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
    __pyx_t_2.memview = NULL;
    __pyx_t_2.data = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4012
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)
 *         if jacobian:
 */
  }

  /* "pyross/inference.pyx":4014
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, l)
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_jacobian); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4014, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":4015
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)
 *         if jacobian:
 *             self.jacobian(s, l)             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ *)__pyx_v_self->__pyx_base.__pyx_vtab)->jacobian(__pyx_v_self, __pyx_v_s, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4014
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, l)
 * 
 */
  }

  /* "pyross/inference.pyx":3998
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_s, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_e, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_a, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ia, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Is, 1);
  __Pyx_XDECREF(__pyx_v_q);
  __PYX_XDEC_MEMVIEW(&__pyx_v_l, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4017
 *             self.jacobian(s, l)
 * 
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_fill_lambdas(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l) {
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  __Pyx_RefNannySetupContext("fill_lambdas", 0);

  /* "pyross/inference.pyx":4019
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):
 *         cdef:
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 4019, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":4020
 *         cdef:
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4020, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4020, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4020, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4021
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             for n in range(M):
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_3;

  /* "pyross/inference.pyx":4022
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 */
  __pyx_t_3 = __pyx_v_M;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_m = __pyx_t_5;

    /* "pyross/inference.pyx":4023
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 * 
 */
    __pyx_t_6 = __pyx_v_M;
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_n = __pyx_t_8;

      /* "pyross/inference.pyx":4024
 *         for m in range(M):
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]             # <<<<<<<<<<<<<<
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):
 */
      __pyx_t_9 = __pyx_v_m;
      __pyx_t_10 = __pyx_v_m;
      __pyx_t_11 = __pyx_v_n;
      __pyx_t_12 = __pyx_v_n;
      __pyx_t_13 = __pyx_v_n;
      __pyx_t_14 = __pyx_v_n;
      __pyx_t_15 = __pyx_v_n;
      __pyx_t_16 = __pyx_v_n;
      __pyx_t_17 = __pyx_v_m;
      *((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_17 * __pyx_v_l.strides[0]) )) += ((((*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_9 * __pyx_v_beta.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_10 * __pyx_v_CM.strides[0]) ) + __pyx_t_11 * __pyx_v_CM.strides[1]) )))) * (((*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_12 * __pyx_v_Ia.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_13 * __pyx_v_a.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_14 * __pyx_v_fsa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_15 * __pyx_v_Is.strides[0]) )))))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_16 * __pyx_v_fi.strides[0]) ))));
    }
  }

  /* "pyross/inference.pyx":4017
 *             self.jacobian(s, l)
 * 
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.fill_lambdas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4026
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_jacobian(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_gE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gA = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tA = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  Py_ssize_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  PyObject *__pyx_t_138 = NULL;
  PyObject *__pyx_t_139 = NULL;
  PyObject *__pyx_t_140 = NULL;
  PyObject *__pyx_t_141 = NULL;
  __Pyx_RefNannySetupContext("jacobian", 0);

  /* "pyross/inference.pyx":4028
 *     cdef jacobian(self, double [:] s, double [:] l):
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim             # <<<<<<<<<<<<<<
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs, beta=self.beta
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":4029
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa             # <<<<<<<<<<<<<<
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __pyx_v_gE = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gA), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __pyx_v_gA = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4030
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs, beta=self.beta             # <<<<<<<<<<<<<<
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4030, __pyx_L1_error)
  __pyx_v_tE = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4030, __pyx_L1_error)
  __pyx_v_tA = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4030, __pyx_L1_error)
  __pyx_v_tIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4030, __pyx_L1_error)
  __pyx_v_tIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4030, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4031
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4031, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4031, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_balpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4031, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4032
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs, beta=self.beta
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.J), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4032, __pyx_L1_error)
  __pyx_v_J = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":4033
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4033, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4034
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_6 = __pyx_t_1;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_m = __pyx_t_7;

    /* "pyross/inference.pyx":4035
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m] - tE[m]
 */
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_9 = 0;
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = 0;
    __pyx_t_12 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_9 * __pyx_v_J.strides[0]) ) + __pyx_t_10 * __pyx_v_J.strides[1]) ) + __pyx_t_11 * __pyx_v_J.strides[2]) ) + __pyx_t_12 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_8 * __pyx_v_l.strides[0]) ))));

    /* "pyross/inference.pyx":4036
 *         for m in range(M):
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 1, m] = - gE[m] - tE[m]
 *             J[2, m, 1, m] = gE[m]
 */
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_14 = 1;
    __pyx_t_15 = __pyx_v_m;
    __pyx_t_16 = 0;
    __pyx_t_17 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_14 * __pyx_v_J.strides[0]) ) + __pyx_t_15 * __pyx_v_J.strides[1]) ) + __pyx_t_16 * __pyx_v_J.strides[2]) ) + __pyx_t_17 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_13 * __pyx_v_l.strides[0]) )));

    /* "pyross/inference.pyx":4037
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m] - tE[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 1, m] = gE[m]
 *             J[2, m, 2, m] = - gA[m] - tA[m]
 */
    __pyx_t_18 = __pyx_v_m;
    __pyx_t_19 = __pyx_v_m;
    __pyx_t_20 = 1;
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_22 = 1;
    __pyx_t_23 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_20 * __pyx_v_J.strides[0]) ) + __pyx_t_21 * __pyx_v_J.strides[1]) ) + __pyx_t_22 * __pyx_v_J.strides[2]) ) + __pyx_t_23 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_18 * __pyx_v_gE.strides[0]) )))) - (*((double *) ( /* dim=0 */ (__pyx_v_tE.data + __pyx_t_19 * __pyx_v_tE.strides[0]) ))));

    /* "pyross/inference.pyx":4038
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m] - tE[m]
 *             J[2, m, 1, m] = gE[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 2, m] = - gA[m] - tA[m]
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 */
    __pyx_t_24 = __pyx_v_m;
    __pyx_t_25 = 2;
    __pyx_t_26 = __pyx_v_m;
    __pyx_t_27 = 1;
    __pyx_t_28 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_25 * __pyx_v_J.strides[0]) ) + __pyx_t_26 * __pyx_v_J.strides[1]) ) + __pyx_t_27 * __pyx_v_J.strides[2]) ) + __pyx_t_28 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_24 * __pyx_v_gE.strides[0]) )));

    /* "pyross/inference.pyx":4039
 *             J[1, m, 1, m] = - gE[m] - tE[m]
 *             J[2, m, 1, m] = gE[m]
 *             J[2, m, 2, m] = - gA[m] - tA[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 *             J[3, m, 3, m] = - gIa[m] - tIa[m]
 */
    __pyx_t_29 = __pyx_v_m;
    __pyx_t_30 = __pyx_v_m;
    __pyx_t_31 = 2;
    __pyx_t_32 = __pyx_v_m;
    __pyx_t_33 = 2;
    __pyx_t_34 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_31 * __pyx_v_J.strides[0]) ) + __pyx_t_32 * __pyx_v_J.strides[1]) ) + __pyx_t_33 * __pyx_v_J.strides[2]) ) + __pyx_t_34 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_29 * __pyx_v_gA.strides[0]) )))) - (*((double *) ( /* dim=0 */ (__pyx_v_tA.data + __pyx_t_30 * __pyx_v_tA.strides[0]) ))));

    /* "pyross/inference.pyx":4040
 *             J[2, m, 1, m] = gE[m]
 *             J[2, m, 2, m] = - gA[m] - tA[m]
 *             J[3, m, 2, m] = alpha[m]*gA[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 3, m] = - gIa[m] - tIa[m]
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 */
    __pyx_t_35 = __pyx_v_m;
    __pyx_t_36 = __pyx_v_m;
    __pyx_t_37 = 3;
    __pyx_t_38 = __pyx_v_m;
    __pyx_t_39 = 2;
    __pyx_t_40 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_37 * __pyx_v_J.strides[0]) ) + __pyx_t_38 * __pyx_v_J.strides[1]) ) + __pyx_t_39 * __pyx_v_J.strides[2]) ) + __pyx_t_40 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_35 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_36 * __pyx_v_gA.strides[0]) ))));

    /* "pyross/inference.pyx":4041
 *             J[2, m, 2, m] = - gA[m] - tA[m]
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 *             J[3, m, 3, m] = - gIa[m] - tIa[m]             # <<<<<<<<<<<<<<
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 *             J[4, m, 4, m] = -gIs[m] - tIs[m]
 */
    __pyx_t_41 = __pyx_v_m;
    __pyx_t_42 = __pyx_v_m;
    __pyx_t_43 = 3;
    __pyx_t_44 = __pyx_v_m;
    __pyx_t_45 = 3;
    __pyx_t_46 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_43 * __pyx_v_J.strides[0]) ) + __pyx_t_44 * __pyx_v_J.strides[1]) ) + __pyx_t_45 * __pyx_v_J.strides[2]) ) + __pyx_t_46 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_41 * __pyx_v_gIa.strides[0]) )))) - (*((double *) ( /* dim=0 */ (__pyx_v_tIa.data + __pyx_t_42 * __pyx_v_tIa.strides[0]) ))));

    /* "pyross/inference.pyx":4042
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 *             J[3, m, 3, m] = - gIa[m] - tIa[m]
 *             J[4, m, 2, m] = balpha[m]*gA[m]             # <<<<<<<<<<<<<<
 *             J[4, m, 4, m] = -gIs[m] - tIs[m]
 *             J[5, m, 1, m] = tE[m]
 */
    __pyx_t_47 = __pyx_v_m;
    __pyx_t_48 = __pyx_v_m;
    __pyx_t_49 = 4;
    __pyx_t_50 = __pyx_v_m;
    __pyx_t_51 = 2;
    __pyx_t_52 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_49 * __pyx_v_J.strides[0]) ) + __pyx_t_50 * __pyx_v_J.strides[1]) ) + __pyx_t_51 * __pyx_v_J.strides[2]) ) + __pyx_t_52 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_47 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_48 * __pyx_v_gA.strides[0]) ))));

    /* "pyross/inference.pyx":4043
 *             J[3, m, 3, m] = - gIa[m] - tIa[m]
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 *             J[4, m, 4, m] = -gIs[m] - tIs[m]             # <<<<<<<<<<<<<<
 *             J[5, m, 1, m] = tE[m]
 *             J[5, m, 2, m] = tA[m]
 */
    __pyx_t_53 = __pyx_v_m;
    __pyx_t_54 = __pyx_v_m;
    __pyx_t_55 = 4;
    __pyx_t_56 = __pyx_v_m;
    __pyx_t_57 = 4;
    __pyx_t_58 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_55 * __pyx_v_J.strides[0]) ) + __pyx_t_56 * __pyx_v_J.strides[1]) ) + __pyx_t_57 * __pyx_v_J.strides[2]) ) + __pyx_t_58 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_53 * __pyx_v_gIs.strides[0]) )))) - (*((double *) ( /* dim=0 */ (__pyx_v_tIs.data + __pyx_t_54 * __pyx_v_tIs.strides[0]) ))));

    /* "pyross/inference.pyx":4044
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 *             J[4, m, 4, m] = -gIs[m] - tIs[m]
 *             J[5, m, 1, m] = tE[m]             # <<<<<<<<<<<<<<
 *             J[5, m, 2, m] = tA[m]
 *             J[5, m, 3, m] = tIa[m]
 */
    __pyx_t_59 = __pyx_v_m;
    __pyx_t_60 = 5;
    __pyx_t_61 = __pyx_v_m;
    __pyx_t_62 = 1;
    __pyx_t_63 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_60 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) ) + __pyx_t_62 * __pyx_v_J.strides[2]) ) + __pyx_t_63 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_tE.data + __pyx_t_59 * __pyx_v_tE.strides[0]) )));

    /* "pyross/inference.pyx":4045
 *             J[4, m, 4, m] = -gIs[m] - tIs[m]
 *             J[5, m, 1, m] = tE[m]
 *             J[5, m, 2, m] = tA[m]             # <<<<<<<<<<<<<<
 *             J[5, m, 3, m] = tIa[m]
 *             J[5, m, 4, m] = tIs[m]
 */
    __pyx_t_64 = __pyx_v_m;
    __pyx_t_65 = 5;
    __pyx_t_66 = __pyx_v_m;
    __pyx_t_67 = 2;
    __pyx_t_68 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_65 * __pyx_v_J.strides[0]) ) + __pyx_t_66 * __pyx_v_J.strides[1]) ) + __pyx_t_67 * __pyx_v_J.strides[2]) ) + __pyx_t_68 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_tA.data + __pyx_t_64 * __pyx_v_tA.strides[0]) )));

    /* "pyross/inference.pyx":4046
 *             J[5, m, 1, m] = tE[m]
 *             J[5, m, 2, m] = tA[m]
 *             J[5, m, 3, m] = tIa[m]             # <<<<<<<<<<<<<<
 *             J[5, m, 4, m] = tIs[m]
 *             for n in range(M):
 */
    __pyx_t_69 = __pyx_v_m;
    __pyx_t_70 = 5;
    __pyx_t_71 = __pyx_v_m;
    __pyx_t_72 = 3;
    __pyx_t_73 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_70 * __pyx_v_J.strides[0]) ) + __pyx_t_71 * __pyx_v_J.strides[1]) ) + __pyx_t_72 * __pyx_v_J.strides[2]) ) + __pyx_t_73 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_tIa.data + __pyx_t_69 * __pyx_v_tIa.strides[0]) )));

    /* "pyross/inference.pyx":4047
 *             J[5, m, 2, m] = tA[m]
 *             J[5, m, 3, m] = tIa[m]
 *             J[5, m, 4, m] = tIs[m]             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 */
    __pyx_t_74 = __pyx_v_m;
    __pyx_t_75 = 5;
    __pyx_t_76 = __pyx_v_m;
    __pyx_t_77 = 4;
    __pyx_t_78 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_75 * __pyx_v_J.strides[0]) ) + __pyx_t_76 * __pyx_v_J.strides[1]) ) + __pyx_t_77 * __pyx_v_J.strides[2]) ) + __pyx_t_78 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_tIs.data + __pyx_t_74 * __pyx_v_tIs.strides[0]) )));

    /* "pyross/inference.pyx":4048
 *             J[5, m, 3, m] = tIa[m]
 *             J[5, m, 4, m] = tIs[m]
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 */
    __pyx_t_79 = __pyx_v_M;
    __pyx_t_80 = __pyx_t_79;
    for (__pyx_t_81 = 0; __pyx_t_81 < __pyx_t_80; __pyx_t_81+=1) {
      __pyx_v_n = __pyx_t_81;

      /* "pyross/inference.pyx":4049
 *             J[5, m, 4, m] = tIs[m]
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_82 = __pyx_v_m;
      __pyx_t_83 = __pyx_v_m;
      __pyx_t_84 = __pyx_v_m;
      __pyx_t_85 = __pyx_v_n;
      __pyx_t_86 = __pyx_v_n;
      __pyx_t_87 = 0;
      __pyx_t_88 = __pyx_v_m;
      __pyx_t_89 = 2;
      __pyx_t_90 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_87 * __pyx_v_J.strides[0]) ) + __pyx_t_88 * __pyx_v_J.strides[1]) ) + __pyx_t_89 * __pyx_v_J.strides[2]) ) + __pyx_t_90 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_82 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_83 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_84 * __pyx_v_CM.strides[0]) ) + __pyx_t_85 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_86 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4050
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_91 = __pyx_v_m;
      __pyx_t_92 = __pyx_v_m;
      __pyx_t_93 = __pyx_v_m;
      __pyx_t_94 = __pyx_v_n;
      __pyx_t_95 = __pyx_v_n;
      __pyx_t_96 = 0;
      __pyx_t_97 = __pyx_v_m;
      __pyx_t_98 = 3;
      __pyx_t_99 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_96 * __pyx_v_J.strides[0]) ) + __pyx_t_97 * __pyx_v_J.strides[1]) ) + __pyx_t_98 * __pyx_v_J.strides[2]) ) + __pyx_t_99 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_91 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_92 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_93 * __pyx_v_CM.strides[0]) ) + __pyx_t_94 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_95 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4051
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_100 = __pyx_v_m;
      __pyx_t_101 = __pyx_v_m;
      __pyx_t_102 = __pyx_v_m;
      __pyx_t_103 = __pyx_v_n;
      __pyx_t_104 = __pyx_v_n;
      __pyx_t_105 = __pyx_v_n;
      __pyx_t_106 = 0;
      __pyx_t_107 = __pyx_v_m;
      __pyx_t_108 = 4;
      __pyx_t_109 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_106 * __pyx_v_J.strides[0]) ) + __pyx_t_107 * __pyx_v_J.strides[1]) ) + __pyx_t_108 * __pyx_v_J.strides[2]) ) + __pyx_t_109 * __pyx_v_J.strides[3]) )) = (((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_100 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_101 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_102 * __pyx_v_CM.strides[0]) ) + __pyx_t_103 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_104 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_105 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4052
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_110 = __pyx_v_m;
      __pyx_t_111 = __pyx_v_m;
      __pyx_t_112 = __pyx_v_m;
      __pyx_t_113 = __pyx_v_n;
      __pyx_t_114 = __pyx_v_n;
      __pyx_t_115 = 1;
      __pyx_t_116 = __pyx_v_m;
      __pyx_t_117 = 2;
      __pyx_t_118 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_115 * __pyx_v_J.strides[0]) ) + __pyx_t_116 * __pyx_v_J.strides[1]) ) + __pyx_t_117 * __pyx_v_J.strides[2]) ) + __pyx_t_118 * __pyx_v_J.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_110 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_111 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_112 * __pyx_v_CM.strides[0]) ) + __pyx_t_113 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_114 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4053
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *         self.J_mat = self.J.reshape((dim, dim))
 */
      __pyx_t_119 = __pyx_v_m;
      __pyx_t_120 = __pyx_v_m;
      __pyx_t_121 = __pyx_v_m;
      __pyx_t_122 = __pyx_v_n;
      __pyx_t_123 = __pyx_v_n;
      __pyx_t_124 = 1;
      __pyx_t_125 = __pyx_v_m;
      __pyx_t_126 = 3;
      __pyx_t_127 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_124 * __pyx_v_J.strides[0]) ) + __pyx_t_125 * __pyx_v_J.strides[1]) ) + __pyx_t_126 * __pyx_v_J.strides[2]) ) + __pyx_t_127 * __pyx_v_J.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_119 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_120 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_121 * __pyx_v_CM.strides[0]) ) + __pyx_t_122 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_123 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4054
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 */
      __pyx_t_128 = __pyx_v_m;
      __pyx_t_129 = __pyx_v_m;
      __pyx_t_130 = __pyx_v_m;
      __pyx_t_131 = __pyx_v_n;
      __pyx_t_132 = __pyx_v_n;
      __pyx_t_133 = __pyx_v_n;
      __pyx_t_134 = 1;
      __pyx_t_135 = __pyx_v_m;
      __pyx_t_136 = 4;
      __pyx_t_137 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_134 * __pyx_v_J.strides[0]) ) + __pyx_t_135 * __pyx_v_J.strides[1]) ) + __pyx_t_136 * __pyx_v_J.strides[2]) ) + __pyx_t_137 * __pyx_v_J.strides[3]) )) = (((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_128 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_129 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_130 * __pyx_v_CM.strides[0]) ) + __pyx_t_131 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_132 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_133 * __pyx_v_fi.strides[0]) ))));
    }
  }

  /* "pyross/inference.pyx":4055
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *         self.J_mat = self.J.reshape((dim, dim))             # <<<<<<<<<<<<<<
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l):
 */
  __pyx_t_138 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.J), __pyx_n_s_reshape); if (unlikely(!__pyx_t_138)) __PYX_ERR(0, 4055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_138);
  __pyx_t_139 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_139)) __PYX_ERR(0, 4055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_139);
  __pyx_t_140 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_140)) __PYX_ERR(0, 4055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_140);
  __pyx_t_141 = PyTuple_New(2); if (unlikely(!__pyx_t_141)) __PYX_ERR(0, 4055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_141);
  __Pyx_GIVEREF(__pyx_t_139);
  PyTuple_SET_ITEM(__pyx_t_141, 0, __pyx_t_139);
  __Pyx_GIVEREF(__pyx_t_140);
  PyTuple_SET_ITEM(__pyx_t_141, 1, __pyx_t_140);
  __pyx_t_139 = 0;
  __pyx_t_140 = 0;
  __pyx_t_140 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_138))) {
    __pyx_t_140 = PyMethod_GET_SELF(__pyx_t_138);
    if (likely(__pyx_t_140)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_138);
      __Pyx_INCREF(__pyx_t_140);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_138, function);
    }
  }
  __pyx_t_3 = (__pyx_t_140) ? __Pyx_PyObject_Call2Args(__pyx_t_138, __pyx_t_140, __pyx_t_141) : __Pyx_PyObject_CallOneArg(__pyx_t_138, __pyx_t_141);
  __Pyx_XDECREF(__pyx_t_140); __pyx_t_140 = 0;
  __Pyx_DECREF(__pyx_t_141); __pyx_t_141 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_138); __pyx_t_138 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4055, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __pyx_v_self->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":4026
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_138);
  __Pyx_XDECREF(__pyx_t_139);
  __Pyx_XDECREF(__pyx_t_140);
  __Pyx_XDECREF(__pyx_t_141);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_gE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gA, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tA, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4057
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

static PyObject *__pyx_f_6pyross_9inference_6SEAIRQ_noise_correlation(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_q, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_M;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gA = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tA = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_tIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_B = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  PyObject *__pyx_t_113 = NULL;
  PyObject *__pyx_t_114 = NULL;
  PyObject *__pyx_t_115 = NULL;
  PyObject *__pyx_t_116 = NULL;
  __Pyx_RefNannySetupContext("noise_correlation", 0);

  /* "pyross/inference.pyx":4059
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l):
 *         cdef:
 *             Py_ssize_t m, M=self.M             # <<<<<<<<<<<<<<
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":4060
 *         cdef:
 *             Py_ssize_t m, M=self.M
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA             # <<<<<<<<<<<<<<
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4060, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4060, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4060, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4060, __pyx_L1_error)
  __pyx_v_gE = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gA), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4060, __pyx_L1_error)
  __pyx_v_gA = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4061
 *             Py_ssize_t m, M=self.M
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs             # <<<<<<<<<<<<<<
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4061, __pyx_L1_error)
  __pyx_v_tE = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4061, __pyx_L1_error)
  __pyx_v_tA = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4061, __pyx_L1_error)
  __pyx_v_tIa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->tIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4061, __pyx_L1_error)
  __pyx_v_tIs = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4062
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4062, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4062, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_balpha = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4063
 *             double [:] tE=self.tE, tA=self.tE, tIa=self.tIa, tIs=self.tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B             # <<<<<<<<<<<<<<
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.B), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4063, __pyx_L1_error)
  __pyx_v_B = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":4064
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_5 = __pyx_t_1;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_m = __pyx_t_6;

    /* "pyross/inference.pyx":4065
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE[m])*e[m]
 */
    __pyx_t_7 = __pyx_v_m;
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_9 = 0;
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = 0;
    __pyx_t_12 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_9 * __pyx_v_B.strides[0]) ) + __pyx_t_10 * __pyx_v_B.strides[1]) ) + __pyx_t_11 * __pyx_v_B.strides[2]) ) + __pyx_t_12 * __pyx_v_B.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_7 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_8 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":4066
 *         for m in range(M): # only fill in the upper triangular form
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE[m])*e[m]
 *             B[1, m, 2, m] = -gE[m]*e[m]
 */
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_14 = __pyx_v_m;
    __pyx_t_15 = 0;
    __pyx_t_16 = __pyx_v_m;
    __pyx_t_17 = 1;
    __pyx_t_18 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_15 * __pyx_v_B.strides[0]) ) + __pyx_t_16 * __pyx_v_B.strides[1]) ) + __pyx_t_17 * __pyx_v_B.strides[2]) ) + __pyx_t_18 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_13 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_14 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":4067
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE[m])*e[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 2, m] = -gE[m]*e[m]
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA[m])*a[m]
 */
    __pyx_t_19 = __pyx_v_m;
    __pyx_t_20 = __pyx_v_m;
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_22 = __pyx_v_m;
    __pyx_t_23 = __pyx_v_m;
    __pyx_t_24 = 1;
    __pyx_t_25 = __pyx_v_m;
    __pyx_t_26 = 1;
    __pyx_t_27 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_24 * __pyx_v_B.strides[0]) ) + __pyx_t_25 * __pyx_v_B.strides[1]) ) + __pyx_t_26 * __pyx_v_B.strides[2]) ) + __pyx_t_27 * __pyx_v_B.strides[3]) )) = (((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_19 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_20 * __pyx_v_s.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_21 * __pyx_v_gE.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_tE.data + __pyx_t_22 * __pyx_v_tE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_23 * __pyx_v_e.strides[0]) )))));

    /* "pyross/inference.pyx":4068
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE[m])*e[m]
 *             B[1, m, 2, m] = -gE[m]*e[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA[m])*a[m]
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 */
    __pyx_t_28 = __pyx_v_m;
    __pyx_t_29 = __pyx_v_m;
    __pyx_t_30 = 1;
    __pyx_t_31 = __pyx_v_m;
    __pyx_t_32 = 2;
    __pyx_t_33 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_30 * __pyx_v_B.strides[0]) ) + __pyx_t_31 * __pyx_v_B.strides[1]) ) + __pyx_t_32 * __pyx_v_B.strides[2]) ) + __pyx_t_33 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_28 * __pyx_v_gE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_29 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":4069
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE[m])*e[m]
 *             B[1, m, 2, m] = -gE[m]*e[m]
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA[m])*a[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 */
    __pyx_t_34 = __pyx_v_m;
    __pyx_t_35 = __pyx_v_m;
    __pyx_t_36 = __pyx_v_m;
    __pyx_t_37 = __pyx_v_m;
    __pyx_t_38 = __pyx_v_m;
    __pyx_t_39 = 2;
    __pyx_t_40 = __pyx_v_m;
    __pyx_t_41 = 2;
    __pyx_t_42 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_39 * __pyx_v_B.strides[0]) ) + __pyx_t_40 * __pyx_v_B.strides[1]) ) + __pyx_t_41 * __pyx_v_B.strides[2]) ) + __pyx_t_42 * __pyx_v_B.strides[3]) )) = (((*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_34 * __pyx_v_gE.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_35 * __pyx_v_e.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_36 * __pyx_v_gA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_tA.data + __pyx_t_37 * __pyx_v_tA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_38 * __pyx_v_a.strides[0]) )))));

    /* "pyross/inference.pyx":4070
 *             B[1, m, 2, m] = -gE[m]*e[m]
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA[m])*a[m]
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa[m])*Ia[m]
 */
    __pyx_t_43 = __pyx_v_m;
    __pyx_t_44 = __pyx_v_m;
    __pyx_t_45 = __pyx_v_m;
    __pyx_t_46 = 2;
    __pyx_t_47 = __pyx_v_m;
    __pyx_t_48 = 3;
    __pyx_t_49 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_46 * __pyx_v_B.strides[0]) ) + __pyx_t_47 * __pyx_v_B.strides[1]) ) + __pyx_t_48 * __pyx_v_B.strides[2]) ) + __pyx_t_49 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_43 * __pyx_v_alpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_44 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_45 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4071
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA[m])*a[m]
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]             # <<<<<<<<<<<<<<
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa[m])*Ia[m]
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs[m])*Is[m]
 */
    __pyx_t_50 = __pyx_v_m;
    __pyx_t_51 = __pyx_v_m;
    __pyx_t_52 = __pyx_v_m;
    __pyx_t_53 = 2;
    __pyx_t_54 = __pyx_v_m;
    __pyx_t_55 = 4;
    __pyx_t_56 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_53 * __pyx_v_B.strides[0]) ) + __pyx_t_54 * __pyx_v_B.strides[1]) ) + __pyx_t_55 * __pyx_v_B.strides[2]) ) + __pyx_t_56 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_50 * __pyx_v_balpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_51 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_52 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4072
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa[m])*Ia[m]             # <<<<<<<<<<<<<<
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs[m])*Is[m]
 *             B[1, m, 5, m] = -tE[m]*e[m]
 */
    __pyx_t_57 = __pyx_v_m;
    __pyx_t_58 = __pyx_v_m;
    __pyx_t_59 = __pyx_v_m;
    __pyx_t_60 = __pyx_v_m;
    __pyx_t_61 = __pyx_v_m;
    __pyx_t_62 = __pyx_v_m;
    __pyx_t_63 = 3;
    __pyx_t_64 = __pyx_v_m;
    __pyx_t_65 = 3;
    __pyx_t_66 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_63 * __pyx_v_B.strides[0]) ) + __pyx_t_64 * __pyx_v_B.strides[1]) ) + __pyx_t_65 * __pyx_v_B.strides[2]) ) + __pyx_t_66 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_57 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_58 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_59 * __pyx_v_a.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_60 * __pyx_v_gIa.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_tIa.data + __pyx_t_61 * __pyx_v_tIa.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_62 * __pyx_v_Ia.strides[0]) )))));

    /* "pyross/inference.pyx":4073
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa[m])*Ia[m]
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs[m])*Is[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 5, m] = -tE[m]*e[m]
 *             B[2, m, 5, m] = -tA[m]*a[m]
 */
    __pyx_t_67 = __pyx_v_m;
    __pyx_t_68 = __pyx_v_m;
    __pyx_t_69 = __pyx_v_m;
    __pyx_t_70 = __pyx_v_m;
    __pyx_t_71 = __pyx_v_m;
    __pyx_t_72 = __pyx_v_m;
    __pyx_t_73 = 4;
    __pyx_t_74 = __pyx_v_m;
    __pyx_t_75 = 4;
    __pyx_t_76 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_73 * __pyx_v_B.strides[0]) ) + __pyx_t_74 * __pyx_v_B.strides[1]) ) + __pyx_t_75 * __pyx_v_B.strides[2]) ) + __pyx_t_76 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_67 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_68 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_69 * __pyx_v_a.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_70 * __pyx_v_gIs.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_tIs.data + __pyx_t_71 * __pyx_v_tIs.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_72 * __pyx_v_Is.strides[0]) )))));

    /* "pyross/inference.pyx":4074
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa[m])*Ia[m]
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs[m])*Is[m]
 *             B[1, m, 5, m] = -tE[m]*e[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 5, m] = -tA[m]*a[m]
 *             B[3, m, 5, m] = -tIa[m]*Ia[m]
 */
    __pyx_t_77 = __pyx_v_m;
    __pyx_t_78 = __pyx_v_m;
    __pyx_t_79 = 1;
    __pyx_t_80 = __pyx_v_m;
    __pyx_t_81 = 5;
    __pyx_t_82 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_79 * __pyx_v_B.strides[0]) ) + __pyx_t_80 * __pyx_v_B.strides[1]) ) + __pyx_t_81 * __pyx_v_B.strides[2]) ) + __pyx_t_82 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_tE.data + __pyx_t_77 * __pyx_v_tE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_78 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":4075
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs[m])*Is[m]
 *             B[1, m, 5, m] = -tE[m]*e[m]
 *             B[2, m, 5, m] = -tA[m]*a[m]             # <<<<<<<<<<<<<<
 *             B[3, m, 5, m] = -tIa[m]*Ia[m]
 *             B[4, m, 5, m] = -tIs[m]*Is[m]
 */
    __pyx_t_83 = __pyx_v_m;
    __pyx_t_84 = __pyx_v_m;
    __pyx_t_85 = 2;
    __pyx_t_86 = __pyx_v_m;
    __pyx_t_87 = 5;
    __pyx_t_88 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_85 * __pyx_v_B.strides[0]) ) + __pyx_t_86 * __pyx_v_B.strides[1]) ) + __pyx_t_87 * __pyx_v_B.strides[2]) ) + __pyx_t_88 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_tA.data + __pyx_t_83 * __pyx_v_tA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_84 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4076
 *             B[1, m, 5, m] = -tE[m]*e[m]
 *             B[2, m, 5, m] = -tA[m]*a[m]
 *             B[3, m, 5, m] = -tIa[m]*Ia[m]             # <<<<<<<<<<<<<<
 *             B[4, m, 5, m] = -tIs[m]*Is[m]
 *             B[5, m, 5, m] = tE[m]*e[m]+tA[m]*a[m]+tIa[m]*Ia[m]+tIs[m]*Is[m]
 */
    __pyx_t_89 = __pyx_v_m;
    __pyx_t_90 = __pyx_v_m;
    __pyx_t_91 = 3;
    __pyx_t_92 = __pyx_v_m;
    __pyx_t_93 = 5;
    __pyx_t_94 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_91 * __pyx_v_B.strides[0]) ) + __pyx_t_92 * __pyx_v_B.strides[1]) ) + __pyx_t_93 * __pyx_v_B.strides[2]) ) + __pyx_t_94 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_tIa.data + __pyx_t_89 * __pyx_v_tIa.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_90 * __pyx_v_Ia.strides[0]) ))));

    /* "pyross/inference.pyx":4077
 *             B[2, m, 5, m] = -tA[m]*a[m]
 *             B[3, m, 5, m] = -tIa[m]*Ia[m]
 *             B[4, m, 5, m] = -tIs[m]*Is[m]             # <<<<<<<<<<<<<<
 *             B[5, m, 5, m] = tE[m]*e[m]+tA[m]*a[m]+tIa[m]*Ia[m]+tIs[m]*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 */
    __pyx_t_95 = __pyx_v_m;
    __pyx_t_96 = __pyx_v_m;
    __pyx_t_97 = 4;
    __pyx_t_98 = __pyx_v_m;
    __pyx_t_99 = 5;
    __pyx_t_100 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_97 * __pyx_v_B.strides[0]) ) + __pyx_t_98 * __pyx_v_B.strides[1]) ) + __pyx_t_99 * __pyx_v_B.strides[2]) ) + __pyx_t_100 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_tIs.data + __pyx_t_95 * __pyx_v_tIs.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_96 * __pyx_v_Is.strides[0]) ))));

    /* "pyross/inference.pyx":4078
 *             B[3, m, 5, m] = -tIa[m]*Ia[m]
 *             B[4, m, 5, m] = -tIs[m]*Is[m]
 *             B[5, m, 5, m] = tE[m]*e[m]+tA[m]*a[m]+tIa[m]*Ia[m]+tIs[m]*Is[m]             # <<<<<<<<<<<<<<
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 * 
 */
    __pyx_t_101 = __pyx_v_m;
    __pyx_t_102 = __pyx_v_m;
    __pyx_t_103 = __pyx_v_m;
    __pyx_t_104 = __pyx_v_m;
    __pyx_t_105 = __pyx_v_m;
    __pyx_t_106 = __pyx_v_m;
    __pyx_t_107 = __pyx_v_m;
    __pyx_t_108 = __pyx_v_m;
    __pyx_t_109 = 5;
    __pyx_t_110 = __pyx_v_m;
    __pyx_t_111 = 5;
    __pyx_t_112 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_109 * __pyx_v_B.strides[0]) ) + __pyx_t_110 * __pyx_v_B.strides[1]) ) + __pyx_t_111 * __pyx_v_B.strides[2]) ) + __pyx_t_112 * __pyx_v_B.strides[3]) )) = (((((*((double *) ( /* dim=0 */ (__pyx_v_tE.data + __pyx_t_101 * __pyx_v_tE.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_102 * __pyx_v_e.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_tA.data + __pyx_t_103 * __pyx_v_tA.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_104 * __pyx_v_a.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_tIa.data + __pyx_t_105 * __pyx_v_tIa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_106 * __pyx_v_Ia.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_tIs.data + __pyx_t_107 * __pyx_v_tIs.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_108 * __pyx_v_Is.strides[0]) )))));
  }

  /* "pyross/inference.pyx":4079
 *             B[4, m, 5, m] = -tIs[m]*Is[m]
 *             B[5, m, 5, m] = tE[m]*e[m]+tA[m]*a[m]+tIa[m]*Ia[m]+tIs[m]*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_113 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.B), __pyx_n_s_reshape); if (unlikely(!__pyx_t_113)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_113);
  __pyx_t_114 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_114)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_114);
  __pyx_t_115 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_115)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_115);
  __pyx_t_116 = PyTuple_New(2); if (unlikely(!__pyx_t_116)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_116);
  __Pyx_GIVEREF(__pyx_t_114);
  PyTuple_SET_ITEM(__pyx_t_116, 0, __pyx_t_114);
  __Pyx_GIVEREF(__pyx_t_115);
  PyTuple_SET_ITEM(__pyx_t_116, 1, __pyx_t_115);
  __pyx_t_114 = 0;
  __pyx_t_115 = 0;
  __pyx_t_115 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_113))) {
    __pyx_t_115 = PyMethod_GET_SELF(__pyx_t_113);
    if (likely(__pyx_t_115)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_113);
      __Pyx_INCREF(__pyx_t_115);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_113, function);
    }
  }
  __pyx_t_3 = (__pyx_t_115) ? __Pyx_PyObject_Call2Args(__pyx_t_113, __pyx_t_115, __pyx_t_116) : __Pyx_PyObject_CallOneArg(__pyx_t_113, __pyx_t_116);
  __Pyx_XDECREF(__pyx_t_115); __pyx_t_115 = 0;
  __Pyx_DECREF(__pyx_t_116); __pyx_t_116 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_113); __pyx_t_113 = 0;
  __pyx_t_113 = PyTuple_New(2); if (unlikely(!__pyx_t_113)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_113);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_113, 0, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_113, 1, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __pyx_t_116 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_113); if (unlikely(!__pyx_t_116)) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_116);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_113); __pyx_t_113 = 0;
  if (!(likely(((__pyx_t_116) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_116, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4079, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_116);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __pyx_v_self->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_116);
  __pyx_t_116 = 0;

  /* "pyross/inference.pyx":4057
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_XDECREF(__pyx_t_113);
  __Pyx_XDECREF(__pyx_t_114);
  __Pyx_XDECREF(__pyx_t_115);
  __Pyx_XDECREF(__pyx_t_116);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.noise_correlation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gA, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tA, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_tIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_B, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3964
 * 
 *     cdef:
 *         readonly np.ndarray gE, gA, tE, tA, tIa, tIs             # <<<<<<<<<<<<<<
 *         readonly pyross.deterministic.SEAIRQ det_model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2gE_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2gE_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_2gE___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2gE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gE));
  __pyx_r = ((PyObject *)__pyx_v_self->gE);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2gA_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2gA_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_2gA___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2gA___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gA));
  __pyx_r = ((PyObject *)__pyx_v_self->gA);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2tE_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2tE_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_2tE___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2tE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tE));
  __pyx_r = ((PyObject *)__pyx_v_self->tE);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2tA_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_2tA_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_2tA___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_2tA___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tA));
  __pyx_r = ((PyObject *)__pyx_v_self->tA);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_3tIa_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_3tIa_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_3tIa___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_3tIa___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tIa));
  __pyx_r = ((PyObject *)__pyx_v_self->tIa);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_3tIs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_3tIs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_3tIs___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_3tIs___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tIs));
  __pyx_r = ((PyObject *)__pyx_v_self->tIs);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":3965
 *     cdef:
 *         readonly np.ndarray gE, gA, tE, tA, tIa, tIs
 *         readonly pyross.deterministic.SEAIRQ det_model             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, parameters, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_9det_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_9det_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_9det_model___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_9det_model___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_r = ((PyObject *)__pyx_v_self->det_model);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_8__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_8__reduce_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.tA, self.tE, self.tIa, self.tIs, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(41); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 16, ((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 17, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 18, ((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gA));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gA));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->gA));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gE));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gE));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->gE));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 26, ((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 27, ((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 28, __pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 29, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 30, __pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 32, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 33, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 34, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 35, __pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tA));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tA));
  PyTuple_SET_ITEM(__pyx_t_10, 36, ((PyObject *)__pyx_v_self->tA));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tE));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tE));
  PyTuple_SET_ITEM(__pyx_t_10, 37, ((PyObject *)__pyx_v_self->tE));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tIa));
  PyTuple_SET_ITEM(__pyx_t_10, 38, ((PyObject *)__pyx_v_self->tIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tIs));
  PyTuple_SET_ITEM(__pyx_t_10, 39, ((PyObject *)__pyx_v_self->tIs));
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 40, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.tA, self.tE, self.tIa, self.tIs, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.tA, self.tE, self.tIa, self.tIs, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.tA is not None or self.tE is not None or self.tIa is not None or self.tIs is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.tA, self.tE, self.tIa, self.tIs, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.tA is not None or self.tE is not None or self.tIa is not None or self.tIs is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.contactMatrix != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.dsigmadt) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.fi) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices1) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices2) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.fsa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->gA) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->gE) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.gIa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.gIs) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.rows) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->tA) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->tE) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->tIa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->tIs) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    __pyx_t_12 = __pyx_t_11;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.tA is not None or self.tE is not None or self.tIa is not None or self.tIs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.tA is not None or self.tE is not None or self.tIa is not None or self.tIs is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SEAIRQ); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_43267880);
    __Pyx_GIVEREF(__pyx_int_43267880);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_43267880);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.tA is not None or self.tE is not None or self.tIa is not None or self.tIs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, None), state
 *     else:
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SEAIRQ__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SEAIRQ); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_43267880);
    __Pyx_GIVEREF(__pyx_int_43267880);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_43267880);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SEAIRQ__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_6SEAIRQ_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_6SEAIRQ_10__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6SEAIRQ_10__setstate_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SEAIRQ__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SEAIRQ, (type(self), 0x2943728, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SEAIRQ__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4154
 *         readonly pyross.deterministic.SEAIRQ_testing det_model
 * 
 *     def __init__(self, parameters, testRate, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gA', \
 *                            'gIa', 'gIs', 'fsa', \
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_14SEAIRQ_testing_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_14SEAIRQ_testing_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_testRate = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parameters,&__pyx_n_s_testRate,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_1);
    values[5] = ((PyObject *)__pyx_int_4);
    values[6] = ((PyObject *)__pyx_n_u_LSODA);
    values[7] = ((PyObject *)__pyx_n_u_LSODA);
    values[8] = ((PyObject *)__pyx_float_1eneg_3);
    values[9] = ((PyObject *)__pyx_float_1eneg_3);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_testRate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 10, 1); __PYX_ERR(0, 4154, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 10, 2); __PYX_ERR(0, 4154, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 10, 3); __PYX_ERR(0, 4154, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 4154, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parameters = values[0];
    __pyx_v_testRate = values[1];
    __pyx_v_M = values[2];
    __pyx_v_fi = values[3];
    __pyx_v_Omega = values[4];
    __pyx_v_steps = values[5];
    __pyx_v_det_method = values[6];
    __pyx_v_lyapunov_method = values[7];
    __pyx_v_rtol_det = values[8];
    __pyx_v_rtol_lyapunov = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4154, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing___init__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self), __pyx_v_parameters, __pyx_v_testRate, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_14SEAIRQ_testing___init__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_parameters, PyObject *__pyx_v_testRate, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyross/inference.pyx":4155
 * 
 *     def __init__(self, parameters, testRate, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gA', \             # <<<<<<<<<<<<<<
 *                            'gIa', 'gIs', 'fsa', \
 *                            'ars', 'kapE']
 */
  __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_alpha);
  __Pyx_GIVEREF(__pyx_n_u_alpha);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_alpha);
  __Pyx_INCREF(__pyx_n_u_beta);
  __Pyx_GIVEREF(__pyx_n_u_beta);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_beta);
  __Pyx_INCREF(__pyx_n_u_gE);
  __Pyx_GIVEREF(__pyx_n_u_gE);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_gE);
  __Pyx_INCREF(__pyx_n_u_gA);
  __Pyx_GIVEREF(__pyx_n_u_gA);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_gA);
  __Pyx_INCREF(__pyx_n_u_gIa);
  __Pyx_GIVEREF(__pyx_n_u_gIa);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_u_gIa);
  __Pyx_INCREF(__pyx_n_u_gIs);
  __Pyx_GIVEREF(__pyx_n_u_gIs);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_u_gIs);
  __Pyx_INCREF(__pyx_n_u_fsa);
  __Pyx_GIVEREF(__pyx_n_u_fsa);
  PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_u_fsa);
  __Pyx_INCREF(__pyx_n_u_ars);
  __Pyx_GIVEREF(__pyx_n_u_ars);
  PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_u_ars);
  __Pyx_INCREF(__pyx_n_u_kapE);
  __Pyx_GIVEREF(__pyx_n_u_kapE);
  PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_u_kapE);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.param_keys);
  __pyx_v_self->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4158
 *                            'gIa', 'gIs', 'fsa', \
 *                            'ars', 'kapE']
 *         super().__init__(parameters, 6, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)             # <<<<<<<<<<<<<<
 *         self.testRate=testRate
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_6, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4158, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_parameters, __pyx_int_6, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4158, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_int_6);
    __Pyx_GIVEREF(__pyx_int_6);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_6);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_rtol_lyapunov);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4159
 *                            'ars', 'kapE']
 *         super().__init__(parameters, 6, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.testRate=testRate             # <<<<<<<<<<<<<<
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}
 *         self.make_det_model(parameters)
 */
  __Pyx_INCREF(__pyx_v_testRate);
  __Pyx_GIVEREF(__pyx_v_testRate);
  __Pyx_GOTREF(__pyx_v_self->testRate);
  __Pyx_DECREF(__pyx_v_self->testRate);
  __pyx_v_self->testRate = __pyx_v_testRate;

  /* "pyross/inference.pyx":4160
 *         super().__init__(parameters, 6, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         self.testRate=testRate
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}             # <<<<<<<<<<<<<<
 *         self.make_det_model(parameters)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_S, __pyx_int_0) < 0) __PYX_ERR(0, 4160, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_E, __pyx_int_1) < 0) __PYX_ERR(0, 4160, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_A, __pyx_int_2) < 0) __PYX_ERR(0, 4160, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Ia, __pyx_int_3) < 0) __PYX_ERR(0, 4160, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Is, __pyx_int_4) < 0) __PYX_ERR(0, 4160, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_Q, __pyx_int_5) < 0) __PYX_ERR(0, 4160, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.class_index_dict);
  __pyx_v_self->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4161
 *         self.testRate=testRate
 *         self.class_index_dict = {'S':0, 'E':1, 'A':2, 'Ia':3, 'Is':4, 'Q':5}
 *         self.make_det_model(parameters)             # <<<<<<<<<<<<<<
 * 
 *     def infection_indices(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_make_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4154
 *         readonly pyross.deterministic.SEAIRQ_testing det_model
 * 
 *     def __init__(self, parameters, testRate, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):             # <<<<<<<<<<<<<<
 *         self.param_keys = ['alpha', 'beta', 'gE', 'gA', \
 *                            'gIa', 'gIs', 'fsa', \
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4163
 *         self.make_det_model(parameters)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return (1, 2, 3, 4)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_2infection_indices(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_2infection_indices(CYTHON_UNUSED struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices", 0);

  /* "pyross/inference.pyx":4164
 * 
 *     def infection_indices(self):
 *         return (1, 2, 3, 4)             # <<<<<<<<<<<<<<
 * 
 *     def set_params(self, parameters):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_tuple__46);
  __pyx_r = __pyx_tuple__46;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4163
 *         self.make_det_model(parameters)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         return (1, 2, 3, 4)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4166
 *         return (1, 2, 3, 4)
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_params (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_4set_params(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_4set_params(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("set_params", 0);

  /* "pyross/inference.pyx":4167
 * 
 *     def set_params(self, parameters):
 *         super().set_params(parameters)             # <<<<<<<<<<<<<<
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 *         self.gA = pyross.utils.age_dep_rates(parameters['gA'], self.M, 'gA')
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_set_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4168
 *     def set_params(self, parameters):
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')             # <<<<<<<<<<<<<<
 *         self.gA = pyross.utils.age_dep_rates(parameters['gA'], self.M, 'gA')
 *         self.ars = pyross.utils.age_dep_rates(parameters['ars'], self.M, 'ars')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_gE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_gE};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4168, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_gE};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4168, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_gE);
    __Pyx_GIVEREF(__pyx_n_u_gE);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_n_u_gE);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4168, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gE);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gE));
  __pyx_v_self->gE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4169
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 *         self.gA = pyross.utils.age_dep_rates(parameters['gA'], self.M, 'gA')             # <<<<<<<<<<<<<<
 *         self.ars = pyross.utils.age_dep_rates(parameters['ars'], self.M, 'ars')
 *         self.kapE = pyross.utils.age_dep_rates(parameters['kapE'], self.M, 'kapE')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_gA); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_7, __pyx_t_4, __pyx_n_u_gA};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4169, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_7, __pyx_t_4, __pyx_n_u_gA};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4169, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_gA);
    __Pyx_GIVEREF(__pyx_n_u_gA);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_n_u_gA);
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4169, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gA);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gA));
  __pyx_v_self->gA = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4170
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 *         self.gA = pyross.utils.age_dep_rates(parameters['gA'], self.M, 'gA')
 *         self.ars = pyross.utils.age_dep_rates(parameters['ars'], self.M, 'ars')             # <<<<<<<<<<<<<<
 *         self.kapE = pyross.utils.age_dep_rates(parameters['kapE'], self.M, 'kapE')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_ars); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_4, __pyx_n_u_ars};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4170, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_4, __pyx_n_u_ars};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4170, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_ars);
    __Pyx_GIVEREF(__pyx_n_u_ars);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_n_u_ars);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->ars);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->ars));
  __pyx_v_self->ars = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4171
 *         self.gA = pyross.utils.age_dep_rates(parameters['gA'], self.M, 'gA')
 *         self.ars = pyross.utils.age_dep_rates(parameters['ars'], self.M, 'ars')
 *         self.kapE = pyross.utils.age_dep_rates(parameters['kapE'], self.M, 'kapE')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_parameters, __pyx_n_u_kapE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_kapE};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4171, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_n_u_kapE};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4171, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_kapE);
    __Pyx_GIVEREF(__pyx_n_u_kapE);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_n_u_kapE);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4171, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->kapE);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->kapE));
  __pyx_v_self->kapE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4166
 *         return (1, 2, 3, 4)
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         super().set_params(parameters)
 *         self.gE = pyross.utils.age_dep_rates(parameters['gE'], self.M, 'gE')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4174
 * 
 * 
 *     def set_testRate(self, testRate):             # <<<<<<<<<<<<<<
 *         self.testRate=testRate
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_7set_testRate(PyObject *__pyx_v_self, PyObject *__pyx_v_testRate); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_7set_testRate(PyObject *__pyx_v_self, PyObject *__pyx_v_testRate) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_testRate (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_6set_testRate(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self), ((PyObject *)__pyx_v_testRate));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_6set_testRate(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_testRate) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_testRate", 0);

  /* "pyross/inference.pyx":4175
 * 
 *     def set_testRate(self, testRate):
 *         self.testRate=testRate             # <<<<<<<<<<<<<<
 * 
 *     def make_det_model(self, parameters):
 */
  __Pyx_INCREF(__pyx_v_testRate);
  __Pyx_GIVEREF(__pyx_v_testRate);
  __Pyx_GOTREF(__pyx_v_self->testRate);
  __Pyx_DECREF(__pyx_v_self->testRate);
  __pyx_v_self->testRate = __pyx_v_testRate;

  /* "pyross/inference.pyx":4174
 * 
 * 
 *     def set_testRate(self, testRate):             # <<<<<<<<<<<<<<
 *         self.testRate=testRate
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4177
 *         self.testRate=testRate
 * 
 *     def make_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SEAIRQ_testing(parameters, self.M, self.fi*self.Omega)
 *         self.det_model.set_testRate(self.testRate)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_9make_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_9make_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_8make_det_model(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_8make_det_model(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("make_det_model", 0);

  /* "pyross/inference.pyx":4178
 * 
 *     def make_det_model(self, parameters):
 *         self.det_model = pyross.deterministic.SEAIRQ_testing(parameters, self.M, self.fi*self.Omega)             # <<<<<<<<<<<<<<
 *         self.det_model.set_testRate(self.testRate)
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SEAIRQ_testing), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":4179
 *     def make_det_model(self, parameters):
 *         self.det_model = pyross.deterministic.SEAIRQ_testing(parameters, self.M, self.fi*self.Omega)
 *         self.det_model.set_testRate(self.testRate)             # <<<<<<<<<<<<<<
 * 
 *     def make_params_dict(self):
 */
  __pyx_t_3 = __pyx_v_self->testRate;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ_testing *)__pyx_v_self->det_model->__pyx_base.__pyx_vtab)->set_testRate(__pyx_v_self->det_model, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4177
 *         self.testRate=testRate
 * 
 *     def make_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         self.det_model = pyross.deterministic.SEAIRQ_testing(parameters, self.M, self.fi*self.Omega)
 *         self.det_model.set_testRate(self.testRate)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.make_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4181
 *         self.det_model.set_testRate(self.testRate)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_11make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_11make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_10make_params_dict(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_10make_params_dict(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_v_parameters = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":4182
 * 
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha,             # <<<<<<<<<<<<<<
 *                       'beta':self.beta,
 *                       'gIa':self.gIa,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_alpha, ((PyObject *)__pyx_v_self->__pyx_base.alpha)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4183
 *     def make_params_dict(self):
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,             # <<<<<<<<<<<<<<
 *                       'gIa':self.gIa,
 *                       'gIs':self.gIs,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_beta, ((PyObject *)__pyx_v_self->__pyx_base.beta)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4184
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,
 *                       'gIa':self.gIa,             # <<<<<<<<<<<<<<
 *                       'gIs':self.gIs,
 *                       'gE':self.gE,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIa, ((PyObject *)__pyx_v_self->__pyx_base.gIa)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4185
 *                       'beta':self.beta,
 *                       'gIa':self.gIa,
 *                       'gIs':self.gIs,             # <<<<<<<<<<<<<<
 *                       'gE':self.gE,
 *                       'gA':self.gA,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gIs, ((PyObject *)__pyx_v_self->__pyx_base.gIs)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4186
 *                       'gIa':self.gIa,
 *                       'gIs':self.gIs,
 *                       'gE':self.gE,             # <<<<<<<<<<<<<<
 *                       'gA':self.gA,
 *                       'fsa': self.fsa,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gE, ((PyObject *)__pyx_v_self->gE)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4187
 *                       'gIs':self.gIs,
 *                       'gE':self.gE,
 *                       'gA':self.gA,             # <<<<<<<<<<<<<<
 *                       'fsa': self.fsa,
 *                       'ars': self.ars,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_gA, ((PyObject *)__pyx_v_self->gA)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4188
 *                       'gE':self.gE,
 *                       'gA':self.gA,
 *                       'fsa': self.fsa,             # <<<<<<<<<<<<<<
 *                       'ars': self.ars,
 *                       'kapE': self.kapE
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_fsa, ((PyObject *)__pyx_v_self->__pyx_base.fsa)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4189
 *                       'gA':self.gA,
 *                       'fsa': self.fsa,
 *                       'ars': self.ars,             # <<<<<<<<<<<<<<
 *                       'kapE': self.kapE
 *                       }
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_ars, ((PyObject *)__pyx_v_self->ars)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)

  /* "pyross/inference.pyx":4190
 *                       'fsa': self.fsa,
 *                       'ars': self.ars,
 *                       'kapE': self.kapE             # <<<<<<<<<<<<<<
 *                       }
 *         return parameters
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_kapE, ((PyObject *)__pyx_v_self->kapE)) < 0) __PYX_ERR(0, 4182, __pyx_L1_error)
  __pyx_v_parameters = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4192
 *                       'kapE': self.kapE
 *                       }
 *         return parameters             # <<<<<<<<<<<<<<
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_parameters);
  __pyx_r = __pyx_v_parameters;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4181
 *         self.det_model.set_testRate(self.testRate)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         parameters = {'alpha':self.alpha,
 *                       'beta':self.beta,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4194
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix *__pyx_optional_args) {

  /* "pyross/inference.pyx":4195
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                             b_matrix=True, jacobian=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:] s, e, a, Ia, Is, Q, TR
 */
  PyObject *__pyx_v_b_matrix = ((PyObject *)Py_True);
  PyObject *__pyx_v_jacobian = ((PyObject *)Py_False);
  __Pyx_memviewslice __pyx_v_s = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_e = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_a = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Ia = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Is = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_TR = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_v_q = NULL;
  __Pyx_memviewslice __pyx_v_l = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_b_matrix = __pyx_optional_args->b_matrix;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_jacobian = __pyx_optional_args->jacobian;
      }
    }
  }

  /* "pyross/inference.pyx":4198
 *         cdef:
 *             double [:] s, e, a, Ia, Is, Q, TR
 *             Py_ssize_t M=self.M             # <<<<<<<<<<<<<<
 *         s = x[0:M]
 *         e = x[M:2*M]
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":4199
 *             double [:] s, e, a, Ia, Is, Q, TR
 *             Py_ssize_t M=self.M
 *         s = x[0:M]             # <<<<<<<<<<<<<<
 *         e = x[M:2*M]
 *         a = x[2*M:3*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    0,
    __pyx_v_M,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4199, __pyx_L1_error)
}

__pyx_v_s = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4200
 *             Py_ssize_t M=self.M
 *         s = x[0:M]
 *         e = x[M:2*M]             # <<<<<<<<<<<<<<
 *         a = x[2*M:3*M]
 *         Ia = x[3*M:4*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    __pyx_v_M,
    (2 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4200, __pyx_L1_error)
}

__pyx_v_e = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4201
 *         s = x[0:M]
 *         e = x[M:2*M]
 *         a = x[2*M:3*M]             # <<<<<<<<<<<<<<
 *         Ia = x[3*M:4*M]
 *         Is = x[4*M:5*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (2 * __pyx_v_M),
    (3 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4201, __pyx_L1_error)
}

__pyx_v_a = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4202
 *         e = x[M:2*M]
 *         a = x[2*M:3*M]
 *         Ia = x[3*M:4*M]             # <<<<<<<<<<<<<<
 *         Is = x[4*M:5*M]
 *         q = x[5*M:6*M]
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (3 * __pyx_v_M),
    (4 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4202, __pyx_L1_error)
}

__pyx_v_Ia = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4203
 *         a = x[2*M:3*M]
 *         Ia = x[3*M:4*M]
 *         Is = x[4*M:5*M]             # <<<<<<<<<<<<<<
 *         q = x[5*M:6*M]
 *         self.CM = self.contactMatrix(t)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (4 * __pyx_v_M),
    (5 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4203, __pyx_L1_error)
}

__pyx_v_Is = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4204
 *         Ia = x[3*M:4*M]
 *         Is = x[4*M:5*M]
 *         q = x[5*M:6*M]             # <<<<<<<<<<<<<<
 *         self.CM = self.contactMatrix(t)
 *         TR=self.testRate(t)
 */
  __pyx_t_2.data = __pyx_v_x.data;
  __pyx_t_2.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
  __pyx_t_3 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_2,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_3,
    (5 * __pyx_v_M),
    (6 * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4204, __pyx_L1_error)
}

__pyx_t_4 = __pyx_memoryview_fromslice(__pyx_t_2, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_v_q = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4205
 *         Is = x[4*M:5*M]
 *         q = x[5*M:6*M]
 *         self.CM = self.contactMatrix(t)             # <<<<<<<<<<<<<<
 *         TR=self.testRate(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __pyx_t_6 = __pyx_v_self->__pyx_base.contactMatrix; __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4205, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __pyx_v_self->__pyx_base.CM = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4206
 *         q = x[5*M:6*M]
 *         self.CM = self.contactMatrix(t)
 *         TR=self.testRate(t)             # <<<<<<<<<<<<<<
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)
 */
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __pyx_t_5 = __pyx_v_self->testRate; __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4206, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_TR = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4207
 *         self.CM = self.contactMatrix(t)
 *         TR=self.testRate(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_l = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4208
 *         TR=self.testRate(t)
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)             # <<<<<<<<<<<<<<
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)
 */
  __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_lambdas(__pyx_v_self, __pyx_v_a, __pyx_v_Ia, __pyx_v_Is, __pyx_v_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":4209
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)
 *         if jacobian:
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_b_matrix); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4209, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":4210
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)             # <<<<<<<<<<<<<<
 *         if jacobian:
 *             self.jacobian(s, e, a, Ia, Is, q, l, TR)
 */
    __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_q, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4210, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self->__pyx_base.__pyx_vtab)->noise_correlation(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_a, __pyx_v_Ia, __pyx_v_Is, __pyx_t_2, __pyx_v_l, __pyx_v_TR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
    __pyx_t_2.memview = NULL;
    __pyx_t_2.data = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4209
 *         cdef double [:] l=np.zeros((M), dtype=DTYPE)
 *         self.fill_lambdas(a, Ia, Is, l)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)
 *         if jacobian:
 */
  }

  /* "pyross/inference.pyx":4211
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, e, a, Ia, Is, q, l, TR)
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_jacobian); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4211, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":4212
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)
 *         if jacobian:
 *             self.jacobian(s, e, a, Ia, Is, q, l, TR)             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):
 */
    __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_q, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4212, __pyx_L1_error)
    __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self->__pyx_base.__pyx_vtab)->jacobian(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_a, __pyx_v_Ia, __pyx_v_Is, __pyx_t_2, __pyx_v_l, __pyx_v_TR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
    __pyx_t_2.memview = NULL;
    __pyx_t_2.data = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4211
 *         if b_matrix:
 *             self.noise_correlation(s, e, a, Ia, Is, q, l, TR)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.jacobian(s, e, a, Ia, Is, q, l, TR)
 * 
 */
  }

  /* "pyross/inference.pyx":4194
 *         return parameters
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_s, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_e, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_a, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ia, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Is, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_TR, 1);
  __Pyx_XDECREF(__pyx_v_q);
  __PYX_XDEC_MEMVIEW(&__pyx_v_l, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4214
 *             self.jacobian(s, e, a, Ia, Is, q, l, TR)
 * 
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_fill_lambdas(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_l) {
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  __Pyx_RefNannySetupContext("fill_lambdas", 0);

  /* "pyross/inference.pyx":4216
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):
 *         cdef:
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 4216, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":4217
 *         cdef:
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4217, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4217, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4217, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4218
 *             double [:, :] CM=self.CM
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             for n in range(M):
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_3;

  /* "pyross/inference.pyx":4219
 *             double [:] fsa=self.fsa, beta=self.beta, fi=self.fi
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 */
  __pyx_t_3 = __pyx_v_M;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_m = __pyx_t_5;

    /* "pyross/inference.pyx":4220
 *             Py_ssize_t m, n, M=self.M
 *         for m in range(M):
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 * 
 */
    __pyx_t_6 = __pyx_v_M;
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_n = __pyx_t_8;

      /* "pyross/inference.pyx":4221
 *         for m in range(M):
 *             for n in range(M):
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]             # <<<<<<<<<<<<<<
 * 
 *     cdef jacobian(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):
 */
      __pyx_t_9 = __pyx_v_m;
      __pyx_t_10 = __pyx_v_m;
      __pyx_t_11 = __pyx_v_n;
      __pyx_t_12 = __pyx_v_n;
      __pyx_t_13 = __pyx_v_n;
      __pyx_t_14 = __pyx_v_n;
      __pyx_t_15 = __pyx_v_n;
      __pyx_t_16 = __pyx_v_n;
      __pyx_t_17 = __pyx_v_m;
      *((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_17 * __pyx_v_l.strides[0]) )) += ((((*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_9 * __pyx_v_beta.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_10 * __pyx_v_CM.strides[0]) ) + __pyx_t_11 * __pyx_v_CM.strides[1]) )))) * (((*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_12 * __pyx_v_Ia.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_13 * __pyx_v_a.strides[0]) )))) + ((*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_14 * __pyx_v_fsa.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_15 * __pyx_v_Is.strides[0]) )))))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_16 * __pyx_v_fi.strides[0]) ))));
    }
  }

  /* "pyross/inference.pyx":4214
 *             self.jacobian(s, e, a, Ia, Is, q, l, TR)
 * 
 *     cdef fill_lambdas(self, double [:] a, double [:] Ia, double [:] Is, double [:] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.fill_lambdas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4223
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_jacobian(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_q, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_TR) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_dim;
  double __pyx_v_Omega;
  __Pyx_memviewslice __pyx_v_gE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gA = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fsa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ars = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_kapE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_t0;
  double __pyx_v_tE;
  double __pyx_v_tA;
  double __pyx_v_tIa;
  double __pyx_v_tIs;
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  double __pyx_t_2;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  Py_ssize_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  Py_ssize_t __pyx_t_138;
  Py_ssize_t __pyx_t_139;
  Py_ssize_t __pyx_t_140;
  Py_ssize_t __pyx_t_141;
  Py_ssize_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  Py_ssize_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  Py_ssize_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  Py_ssize_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  Py_ssize_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  Py_ssize_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  Py_ssize_t __pyx_t_154;
  Py_ssize_t __pyx_t_155;
  Py_ssize_t __pyx_t_156;
  Py_ssize_t __pyx_t_157;
  Py_ssize_t __pyx_t_158;
  Py_ssize_t __pyx_t_159;
  Py_ssize_t __pyx_t_160;
  Py_ssize_t __pyx_t_161;
  Py_ssize_t __pyx_t_162;
  Py_ssize_t __pyx_t_163;
  Py_ssize_t __pyx_t_164;
  Py_ssize_t __pyx_t_165;
  Py_ssize_t __pyx_t_166;
  Py_ssize_t __pyx_t_167;
  Py_ssize_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  Py_ssize_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  Py_ssize_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  Py_ssize_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  Py_ssize_t __pyx_t_176;
  Py_ssize_t __pyx_t_177;
  Py_ssize_t __pyx_t_178;
  Py_ssize_t __pyx_t_179;
  Py_ssize_t __pyx_t_180;
  Py_ssize_t __pyx_t_181;
  Py_ssize_t __pyx_t_182;
  Py_ssize_t __pyx_t_183;
  Py_ssize_t __pyx_t_184;
  Py_ssize_t __pyx_t_185;
  Py_ssize_t __pyx_t_186;
  Py_ssize_t __pyx_t_187;
  Py_ssize_t __pyx_t_188;
  Py_ssize_t __pyx_t_189;
  Py_ssize_t __pyx_t_190;
  Py_ssize_t __pyx_t_191;
  Py_ssize_t __pyx_t_192;
  Py_ssize_t __pyx_t_193;
  Py_ssize_t __pyx_t_194;
  Py_ssize_t __pyx_t_195;
  Py_ssize_t __pyx_t_196;
  Py_ssize_t __pyx_t_197;
  Py_ssize_t __pyx_t_198;
  Py_ssize_t __pyx_t_199;
  Py_ssize_t __pyx_t_200;
  Py_ssize_t __pyx_t_201;
  Py_ssize_t __pyx_t_202;
  Py_ssize_t __pyx_t_203;
  PyObject *__pyx_t_204 = NULL;
  __Pyx_RefNannySetupContext("jacobian", 0);

  /* "pyross/inference.pyx":4225
 *     cdef jacobian(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim             # <<<<<<<<<<<<<<
 *             double Omega = self.Omega
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":4226
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double Omega = self.Omega             # <<<<<<<<<<<<<<
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa
 *             double [:] ars=self.ars, kapE=self.kapE, beta=self.beta
 */
  __pyx_t_2 = __pyx_v_self->__pyx_base.Omega;
  __pyx_v_Omega = __pyx_t_2;

  /* "pyross/inference.pyx":4227
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 *             double Omega = self.Omega
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa             # <<<<<<<<<<<<<<
 *             double [:] ars=self.ars, kapE=self.kapE, beta=self.beta
 *             double t0, tE, tA, tIa, tIs
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4227, __pyx_L1_error)
  __pyx_v_gE = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gA), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4227, __pyx_L1_error)
  __pyx_v_gA = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4227, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4227, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fsa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4227, __pyx_L1_error)
  __pyx_v_fsa = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4228
 *             double Omega = self.Omega
 *             double [:] gE=self.gE, gA=self.gA, gIa=self.gIa, gIs=self.gIs, fsa=self.fsa
 *             double [:] ars=self.ars, kapE=self.kapE, beta=self.beta             # <<<<<<<<<<<<<<
 *             double t0, tE, tA, tIa, tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->ars), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4228, __pyx_L1_error)
  __pyx_v_ars = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->kapE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4228, __pyx_L1_error)
  __pyx_v_kapE = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4228, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4230
 *             double [:] ars=self.ars, kapE=self.kapE, beta=self.beta
 *             double t0, tE, tA, tIa, tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4230, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_4 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_balpha = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4230, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4231
 *             double t0, tE, tA, tIa, tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.J), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4231, __pyx_L1_error)
  __pyx_v_J = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4232
 *             double [:] alpha=self.alpha, balpha=1-self.alpha, fi=self.fi
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *         for m in range(M):
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 4232, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":4233
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_7 = __pyx_t_1;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_m = __pyx_t_8;

    /* "pyross/inference.pyx":4234
 *             double [:, :] CM=self.CM
 *         for m in range(M):
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])             # <<<<<<<<<<<<<<
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 *             tA= TR[m]*ars[m]*t0/Omega
 */
    __pyx_t_9 = __pyx_v_m;
    __pyx_t_4 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_9 * __pyx_v_ars.strides[0]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_v_m, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __pyx_v_m;
    __pyx_t_12 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_q.data + __pyx_t_11 * __pyx_v_q.strides[0]) )))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyNumber_Subtract(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_14 = __pyx_v_m;
    __pyx_t_12 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_14 * __pyx_v_Is.strides[0]) )))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_15 = __pyx_v_m;
    __pyx_t_10 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_15 * __pyx_v_Is.strides[0]) )))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = PyNumber_Add(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_, __pyx_t_4, 1., 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_t0 = __pyx_t_2;

    /* "pyross/inference.pyx":4235
 *         for m in range(M):
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega             # <<<<<<<<<<<<<<
 *             tA= TR[m]*ars[m]*t0/Omega
 *             tIa = TR[m]*ars[m]*t0/Omega
 */
    __pyx_t_16 = __pyx_v_m;
    __pyx_t_17 = __pyx_v_m;
    __pyx_t_18 = __pyx_v_m;
    __pyx_v_tE = (((((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_16 * __pyx_v_TR.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_17 * __pyx_v_ars.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_kapE.data + __pyx_t_18 * __pyx_v_kapE.strides[0]) )))) * __pyx_v_t0) / __pyx_v_Omega);

    /* "pyross/inference.pyx":4236
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 *             tA= TR[m]*ars[m]*t0/Omega             # <<<<<<<<<<<<<<
 *             tIa = TR[m]*ars[m]*t0/Omega
 *             tIs = TR[m]*t0/Omega
 */
    __pyx_t_19 = __pyx_v_m;
    __pyx_t_20 = __pyx_v_m;
    __pyx_v_tA = ((((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_19 * __pyx_v_TR.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_20 * __pyx_v_ars.strides[0]) )))) * __pyx_v_t0) / __pyx_v_Omega);

    /* "pyross/inference.pyx":4237
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 *             tA= TR[m]*ars[m]*t0/Omega
 *             tIa = TR[m]*ars[m]*t0/Omega             # <<<<<<<<<<<<<<
 *             tIs = TR[m]*t0/Omega
 * 
 */
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_22 = __pyx_v_m;
    __pyx_v_tIa = ((((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_21 * __pyx_v_TR.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_22 * __pyx_v_ars.strides[0]) )))) * __pyx_v_t0) / __pyx_v_Omega);

    /* "pyross/inference.pyx":4238
 *             tA= TR[m]*ars[m]*t0/Omega
 *             tIa = TR[m]*ars[m]*t0/Omega
 *             tIs = TR[m]*t0/Omega             # <<<<<<<<<<<<<<
 * 
 *             for n in range(M):
 */
    __pyx_t_23 = __pyx_v_m;
    __pyx_v_tIs = (((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_23 * __pyx_v_TR.strides[0]) ))) * __pyx_v_t0) / __pyx_v_Omega);

    /* "pyross/inference.pyx":4240
 *             tIs = TR[m]*t0/Omega
 * 
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 */
    __pyx_t_24 = __pyx_v_M;
    __pyx_t_25 = __pyx_t_24;
    for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
      __pyx_v_n = __pyx_t_26;

      /* "pyross/inference.pyx":4241
 * 
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_27 = __pyx_v_m;
      __pyx_t_28 = __pyx_v_m;
      __pyx_t_29 = __pyx_v_m;
      __pyx_t_30 = __pyx_v_n;
      __pyx_t_31 = __pyx_v_n;
      __pyx_t_32 = 0;
      __pyx_t_33 = __pyx_v_m;
      __pyx_t_34 = 2;
      __pyx_t_35 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_32 * __pyx_v_J.strides[0]) ) + __pyx_t_33 * __pyx_v_J.strides[1]) ) + __pyx_t_34 * __pyx_v_J.strides[2]) ) + __pyx_t_35 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_27 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_28 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_29 * __pyx_v_CM.strides[0]) ) + __pyx_t_30 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_31 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4242
 *             for n in range(M):
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_36 = __pyx_v_m;
      __pyx_t_37 = __pyx_v_m;
      __pyx_t_38 = __pyx_v_m;
      __pyx_t_39 = __pyx_v_n;
      __pyx_t_40 = __pyx_v_n;
      __pyx_t_41 = 0;
      __pyx_t_42 = __pyx_v_m;
      __pyx_t_43 = 3;
      __pyx_t_44 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_41 * __pyx_v_J.strides[0]) ) + __pyx_t_42 * __pyx_v_J.strides[1]) ) + __pyx_t_43 * __pyx_v_J.strides[2]) ) + __pyx_t_44 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_36 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_37 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_38 * __pyx_v_CM.strides[0]) ) + __pyx_t_39 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_40 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4243
 *                 J[0, m, 2, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 */
      __pyx_t_45 = __pyx_v_m;
      __pyx_t_46 = __pyx_v_m;
      __pyx_t_47 = __pyx_v_m;
      __pyx_t_48 = __pyx_v_n;
      __pyx_t_49 = __pyx_v_n;
      __pyx_t_50 = __pyx_v_n;
      __pyx_t_51 = 0;
      __pyx_t_52 = __pyx_v_m;
      __pyx_t_53 = 4;
      __pyx_t_54 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_51 * __pyx_v_J.strides[0]) ) + __pyx_t_52 * __pyx_v_J.strides[1]) ) + __pyx_t_53 * __pyx_v_J.strides[2]) ) + __pyx_t_54 * __pyx_v_J.strides[3]) )) = (((((-(*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_45 * __pyx_v_s.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_46 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_47 * __pyx_v_CM.strides[0]) ) + __pyx_t_48 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_49 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_50 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4244
 *                 J[0, m, 3, n] = -s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 */
      __pyx_t_55 = __pyx_v_m;
      __pyx_t_56 = __pyx_v_m;
      __pyx_t_57 = __pyx_v_m;
      __pyx_t_58 = __pyx_v_n;
      __pyx_t_59 = __pyx_v_n;
      __pyx_t_60 = 1;
      __pyx_t_61 = __pyx_v_m;
      __pyx_t_62 = 2;
      __pyx_t_63 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_60 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) ) + __pyx_t_62 * __pyx_v_J.strides[2]) ) + __pyx_t_63 * __pyx_v_J.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_55 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_56 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_57 * __pyx_v_CM.strides[0]) ) + __pyx_t_58 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_59 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4245
 *                 J[0, m, 4, n] = -s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *             J[0, m, 0, m] = -l[m]
 */
      __pyx_t_64 = __pyx_v_m;
      __pyx_t_65 = __pyx_v_m;
      __pyx_t_66 = __pyx_v_m;
      __pyx_t_67 = __pyx_v_n;
      __pyx_t_68 = __pyx_v_n;
      __pyx_t_69 = 1;
      __pyx_t_70 = __pyx_v_m;
      __pyx_t_71 = 3;
      __pyx_t_72 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_69 * __pyx_v_J.strides[0]) ) + __pyx_t_70 * __pyx_v_J.strides[1]) ) + __pyx_t_71 * __pyx_v_J.strides[2]) ) + __pyx_t_72 * __pyx_v_J.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_64 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_65 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_66 * __pyx_v_CM.strides[0]) ) + __pyx_t_67 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_68 * __pyx_v_fi.strides[0]) ))));

      /* "pyross/inference.pyx":4246
 *                 J[1, m, 2, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]             # <<<<<<<<<<<<<<
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]
 */
      __pyx_t_73 = __pyx_v_m;
      __pyx_t_74 = __pyx_v_m;
      __pyx_t_75 = __pyx_v_m;
      __pyx_t_76 = __pyx_v_n;
      __pyx_t_77 = __pyx_v_n;
      __pyx_t_78 = __pyx_v_n;
      __pyx_t_79 = 1;
      __pyx_t_80 = __pyx_v_m;
      __pyx_t_81 = 4;
      __pyx_t_82 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_79 * __pyx_v_J.strides[0]) ) + __pyx_t_80 * __pyx_v_J.strides[1]) ) + __pyx_t_81 * __pyx_v_J.strides[2]) ) + __pyx_t_82 * __pyx_v_J.strides[3]) )) = (((((*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_73 * __pyx_v_s.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_beta.data + __pyx_t_74 * __pyx_v_beta.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_75 * __pyx_v_CM.strides[0]) ) + __pyx_t_76 * __pyx_v_CM.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fsa.data + __pyx_t_77 * __pyx_v_fsa.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_78 * __pyx_v_fi.strides[0]) ))));
    }

    /* "pyross/inference.pyx":4247
 *                 J[1, m, 3, n] = s[m]*beta[m]*CM[m, n]/fi[n]
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *             J[0, m, 0, m] = -l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m] - tE
 */
    __pyx_t_83 = __pyx_v_m;
    __pyx_t_84 = 0;
    __pyx_t_85 = __pyx_v_m;
    __pyx_t_86 = 0;
    __pyx_t_87 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_84 * __pyx_v_J.strides[0]) ) + __pyx_t_85 * __pyx_v_J.strides[1]) ) + __pyx_t_86 * __pyx_v_J.strides[2]) ) + __pyx_t_87 * __pyx_v_J.strides[3]) )) = (-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_83 * __pyx_v_l.strides[0]) ))));

    /* "pyross/inference.pyx":4248
 *                 J[1, m, 4, n] = s[m]*beta[m]*CM[m, n]*fsa[n]/fi[n]
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 1, m] = - gE[m] - tE
 *             J[1, m, 4, m] += (1-ars[m])*tE*t0*e[m]
 */
    __pyx_t_88 = __pyx_v_m;
    __pyx_t_89 = 1;
    __pyx_t_90 = __pyx_v_m;
    __pyx_t_91 = 0;
    __pyx_t_92 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_89 * __pyx_v_J.strides[0]) ) + __pyx_t_90 * __pyx_v_J.strides[1]) ) + __pyx_t_91 * __pyx_v_J.strides[2]) ) + __pyx_t_92 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_88 * __pyx_v_l.strides[0]) )));

    /* "pyross/inference.pyx":4249
 *             J[0, m, 0, m] = -l[m]
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m] - tE             # <<<<<<<<<<<<<<
 *             J[1, m, 4, m] += (1-ars[m])*tE*t0*e[m]
 *             J[1, m, 5, m] = -ars[m]*tE*t0*e[m]
 */
    __pyx_t_93 = __pyx_v_m;
    __pyx_t_94 = 1;
    __pyx_t_95 = __pyx_v_m;
    __pyx_t_96 = 1;
    __pyx_t_97 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_94 * __pyx_v_J.strides[0]) ) + __pyx_t_95 * __pyx_v_J.strides[1]) ) + __pyx_t_96 * __pyx_v_J.strides[2]) ) + __pyx_t_97 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_93 * __pyx_v_gE.strides[0]) )))) - __pyx_v_tE);

    /* "pyross/inference.pyx":4250
 *             J[1, m, 0, m] = l[m]
 *             J[1, m, 1, m] = - gE[m] - tE
 *             J[1, m, 4, m] += (1-ars[m])*tE*t0*e[m]             # <<<<<<<<<<<<<<
 *             J[1, m, 5, m] = -ars[m]*tE*t0*e[m]
 *             J[2, m, 1, m] = gE[m]
 */
    __pyx_t_98 = __pyx_v_m;
    __pyx_t_99 = __pyx_v_m;
    __pyx_t_100 = 1;
    __pyx_t_101 = __pyx_v_m;
    __pyx_t_102 = 4;
    __pyx_t_103 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_100 * __pyx_v_J.strides[0]) ) + __pyx_t_101 * __pyx_v_J.strides[1]) ) + __pyx_t_102 * __pyx_v_J.strides[2]) ) + __pyx_t_103 * __pyx_v_J.strides[3]) )) += ((((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_98 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tE) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_99 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":4251
 *             J[1, m, 1, m] = - gE[m] - tE
 *             J[1, m, 4, m] += (1-ars[m])*tE*t0*e[m]
 *             J[1, m, 5, m] = -ars[m]*tE*t0*e[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 1, m] = gE[m]
 *             J[2, m, 2, m] = - gA[m] - tA
 */
    __pyx_t_104 = __pyx_v_m;
    __pyx_t_105 = __pyx_v_m;
    __pyx_t_106 = 1;
    __pyx_t_107 = __pyx_v_m;
    __pyx_t_108 = 5;
    __pyx_t_109 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_106 * __pyx_v_J.strides[0]) ) + __pyx_t_107 * __pyx_v_J.strides[1]) ) + __pyx_t_108 * __pyx_v_J.strides[2]) ) + __pyx_t_109 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_104 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tE) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_105 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":4252
 *             J[1, m, 4, m] += (1-ars[m])*tE*t0*e[m]
 *             J[1, m, 5, m] = -ars[m]*tE*t0*e[m]
 *             J[2, m, 1, m] = gE[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 2, m] = - gA[m] - tA
 *             J[2, m, 4, m] = (1-ars[m])*tA*t0*a[m]
 */
    __pyx_t_110 = __pyx_v_m;
    __pyx_t_111 = 2;
    __pyx_t_112 = __pyx_v_m;
    __pyx_t_113 = 1;
    __pyx_t_114 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_111 * __pyx_v_J.strides[0]) ) + __pyx_t_112 * __pyx_v_J.strides[1]) ) + __pyx_t_113 * __pyx_v_J.strides[2]) ) + __pyx_t_114 * __pyx_v_J.strides[3]) )) = (*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_110 * __pyx_v_gE.strides[0]) )));

    /* "pyross/inference.pyx":4253
 *             J[1, m, 5, m] = -ars[m]*tE*t0*e[m]
 *             J[2, m, 1, m] = gE[m]
 *             J[2, m, 2, m] = - gA[m] - tA             # <<<<<<<<<<<<<<
 *             J[2, m, 4, m] = (1-ars[m])*tA*t0*a[m]
 *             J[2, m, 5, m] = - ars[m]*tA*t0*a[m]
 */
    __pyx_t_115 = __pyx_v_m;
    __pyx_t_116 = 2;
    __pyx_t_117 = __pyx_v_m;
    __pyx_t_118 = 2;
    __pyx_t_119 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_116 * __pyx_v_J.strides[0]) ) + __pyx_t_117 * __pyx_v_J.strides[1]) ) + __pyx_t_118 * __pyx_v_J.strides[2]) ) + __pyx_t_119 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_115 * __pyx_v_gA.strides[0]) )))) - __pyx_v_tA);

    /* "pyross/inference.pyx":4254
 *             J[2, m, 1, m] = gE[m]
 *             J[2, m, 2, m] = - gA[m] - tA
 *             J[2, m, 4, m] = (1-ars[m])*tA*t0*a[m]             # <<<<<<<<<<<<<<
 *             J[2, m, 5, m] = - ars[m]*tA*t0*a[m]
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 */
    __pyx_t_120 = __pyx_v_m;
    __pyx_t_121 = __pyx_v_m;
    __pyx_t_122 = 2;
    __pyx_t_123 = __pyx_v_m;
    __pyx_t_124 = 4;
    __pyx_t_125 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_122 * __pyx_v_J.strides[0]) ) + __pyx_t_123 * __pyx_v_J.strides[1]) ) + __pyx_t_124 * __pyx_v_J.strides[2]) ) + __pyx_t_125 * __pyx_v_J.strides[3]) )) = ((((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_120 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tA) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_121 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4255
 *             J[2, m, 2, m] = - gA[m] - tA
 *             J[2, m, 4, m] = (1-ars[m])*tA*t0*a[m]
 *             J[2, m, 5, m] = - ars[m]*tA*t0*a[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 *             J[3, m, 3, m] = - gIa[m] - tIa
 */
    __pyx_t_126 = __pyx_v_m;
    __pyx_t_127 = __pyx_v_m;
    __pyx_t_128 = 2;
    __pyx_t_129 = __pyx_v_m;
    __pyx_t_130 = 5;
    __pyx_t_131 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_128 * __pyx_v_J.strides[0]) ) + __pyx_t_129 * __pyx_v_J.strides[1]) ) + __pyx_t_130 * __pyx_v_J.strides[2]) ) + __pyx_t_131 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_126 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tA) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_127 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4256
 *             J[2, m, 4, m] = (1-ars[m])*tA*t0*a[m]
 *             J[2, m, 5, m] = - ars[m]*tA*t0*a[m]
 *             J[3, m, 2, m] = alpha[m]*gA[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 3, m] = - gIa[m] - tIa
 *             J[3, m, 4, m] = (1-ars[m])*tIa*t0*Ia[m]
 */
    __pyx_t_132 = __pyx_v_m;
    __pyx_t_133 = __pyx_v_m;
    __pyx_t_134 = 3;
    __pyx_t_135 = __pyx_v_m;
    __pyx_t_136 = 2;
    __pyx_t_137 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_134 * __pyx_v_J.strides[0]) ) + __pyx_t_135 * __pyx_v_J.strides[1]) ) + __pyx_t_136 * __pyx_v_J.strides[2]) ) + __pyx_t_137 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_132 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_133 * __pyx_v_gA.strides[0]) ))));

    /* "pyross/inference.pyx":4257
 *             J[2, m, 5, m] = - ars[m]*tA*t0*a[m]
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 *             J[3, m, 3, m] = - gIa[m] - tIa             # <<<<<<<<<<<<<<
 *             J[3, m, 4, m] = (1-ars[m])*tIa*t0*Ia[m]
 *             J[3, m, 5, m] = - ars[m]*tIa*t0*Ia[m]
 */
    __pyx_t_138 = __pyx_v_m;
    __pyx_t_139 = 3;
    __pyx_t_140 = __pyx_v_m;
    __pyx_t_141 = 3;
    __pyx_t_142 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_139 * __pyx_v_J.strides[0]) ) + __pyx_t_140 * __pyx_v_J.strides[1]) ) + __pyx_t_141 * __pyx_v_J.strides[2]) ) + __pyx_t_142 * __pyx_v_J.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_138 * __pyx_v_gIa.strides[0]) )))) - __pyx_v_tIa);

    /* "pyross/inference.pyx":4258
 *             J[3, m, 2, m] = alpha[m]*gA[m]
 *             J[3, m, 3, m] = - gIa[m] - tIa
 *             J[3, m, 4, m] = (1-ars[m])*tIa*t0*Ia[m]             # <<<<<<<<<<<<<<
 *             J[3, m, 5, m] = - ars[m]*tIa*t0*Ia[m]
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 */
    __pyx_t_143 = __pyx_v_m;
    __pyx_t_144 = __pyx_v_m;
    __pyx_t_145 = 3;
    __pyx_t_146 = __pyx_v_m;
    __pyx_t_147 = 4;
    __pyx_t_148 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_145 * __pyx_v_J.strides[0]) ) + __pyx_t_146 * __pyx_v_J.strides[1]) ) + __pyx_t_147 * __pyx_v_J.strides[2]) ) + __pyx_t_148 * __pyx_v_J.strides[3]) )) = ((((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_143 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tIa) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_144 * __pyx_v_Ia.strides[0]) ))));

    /* "pyross/inference.pyx":4259
 *             J[3, m, 3, m] = - gIa[m] - tIa
 *             J[3, m, 4, m] = (1-ars[m])*tIa*t0*Ia[m]
 *             J[3, m, 5, m] = - ars[m]*tIa*t0*Ia[m]             # <<<<<<<<<<<<<<
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 *             J[4, m, 4, m] = - gIs[m] - tIs + (1-ars[m])*tIs*t0*Is[m]
 */
    __pyx_t_149 = __pyx_v_m;
    __pyx_t_150 = __pyx_v_m;
    __pyx_t_151 = 3;
    __pyx_t_152 = __pyx_v_m;
    __pyx_t_153 = 5;
    __pyx_t_154 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_151 * __pyx_v_J.strides[0]) ) + __pyx_t_152 * __pyx_v_J.strides[1]) ) + __pyx_t_153 * __pyx_v_J.strides[2]) ) + __pyx_t_154 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_149 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tIa) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_150 * __pyx_v_Ia.strides[0]) ))));

    /* "pyross/inference.pyx":4260
 *             J[3, m, 4, m] = (1-ars[m])*tIa*t0*Ia[m]
 *             J[3, m, 5, m] = - ars[m]*tIa*t0*Ia[m]
 *             J[4, m, 2, m] = balpha[m]*gA[m]             # <<<<<<<<<<<<<<
 *             J[4, m, 4, m] = - gIs[m] - tIs + (1-ars[m])*tIs*t0*Is[m]
 *             J[4, m, 5, m] = - ars[m]*tIs*t0*Is[m]
 */
    __pyx_t_155 = __pyx_v_m;
    __pyx_t_156 = __pyx_v_m;
    __pyx_t_157 = 4;
    __pyx_t_158 = __pyx_v_m;
    __pyx_t_159 = 2;
    __pyx_t_160 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_157 * __pyx_v_J.strides[0]) ) + __pyx_t_158 * __pyx_v_J.strides[1]) ) + __pyx_t_159 * __pyx_v_J.strides[2]) ) + __pyx_t_160 * __pyx_v_J.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_155 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_156 * __pyx_v_gA.strides[0]) ))));

    /* "pyross/inference.pyx":4261
 *             J[3, m, 5, m] = - ars[m]*tIa*t0*Ia[m]
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 *             J[4, m, 4, m] = - gIs[m] - tIs + (1-ars[m])*tIs*t0*Is[m]             # <<<<<<<<<<<<<<
 *             J[4, m, 5, m] = - ars[m]*tIs*t0*Is[m]
 *             J[5, m, 1, m] = tE
 */
    __pyx_t_161 = __pyx_v_m;
    __pyx_t_162 = __pyx_v_m;
    __pyx_t_163 = __pyx_v_m;
    __pyx_t_164 = 4;
    __pyx_t_165 = __pyx_v_m;
    __pyx_t_166 = 4;
    __pyx_t_167 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_164 * __pyx_v_J.strides[0]) ) + __pyx_t_165 * __pyx_v_J.strides[1]) ) + __pyx_t_166 * __pyx_v_J.strides[2]) ) + __pyx_t_167 * __pyx_v_J.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_161 * __pyx_v_gIs.strides[0]) )))) - __pyx_v_tIs) + ((((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_162 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tIs) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_163 * __pyx_v_Is.strides[0]) )))));

    /* "pyross/inference.pyx":4262
 *             J[4, m, 2, m] = balpha[m]*gA[m]
 *             J[4, m, 4, m] = - gIs[m] - tIs + (1-ars[m])*tIs*t0*Is[m]
 *             J[4, m, 5, m] = - ars[m]*tIs*t0*Is[m]             # <<<<<<<<<<<<<<
 *             J[5, m, 1, m] = tE
 *             J[5, m, 2, m] = tA
 */
    __pyx_t_168 = __pyx_v_m;
    __pyx_t_169 = __pyx_v_m;
    __pyx_t_170 = 4;
    __pyx_t_171 = __pyx_v_m;
    __pyx_t_172 = 5;
    __pyx_t_173 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_170 * __pyx_v_J.strides[0]) ) + __pyx_t_171 * __pyx_v_J.strides[1]) ) + __pyx_t_172 * __pyx_v_J.strides[2]) ) + __pyx_t_173 * __pyx_v_J.strides[3]) )) = ((((-(*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_168 * __pyx_v_ars.strides[0]) )))) * __pyx_v_tIs) * __pyx_v_t0) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_169 * __pyx_v_Is.strides[0]) ))));

    /* "pyross/inference.pyx":4263
 *             J[4, m, 4, m] = - gIs[m] - tIs + (1-ars[m])*tIs*t0*Is[m]
 *             J[4, m, 5, m] = - ars[m]*tIs*t0*Is[m]
 *             J[5, m, 1, m] = tE             # <<<<<<<<<<<<<<
 *             J[5, m, 2, m] = tA
 *             J[5, m, 3, m] = tIa
 */
    __pyx_t_174 = 5;
    __pyx_t_175 = __pyx_v_m;
    __pyx_t_176 = 1;
    __pyx_t_177 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_174 * __pyx_v_J.strides[0]) ) + __pyx_t_175 * __pyx_v_J.strides[1]) ) + __pyx_t_176 * __pyx_v_J.strides[2]) ) + __pyx_t_177 * __pyx_v_J.strides[3]) )) = __pyx_v_tE;

    /* "pyross/inference.pyx":4264
 *             J[4, m, 5, m] = - ars[m]*tIs*t0*Is[m]
 *             J[5, m, 1, m] = tE
 *             J[5, m, 2, m] = tA             # <<<<<<<<<<<<<<
 *             J[5, m, 3, m] = tIa
 *             J[5, m, 4, m] = tIs - (1-ars[m])*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 */
    __pyx_t_178 = 5;
    __pyx_t_179 = __pyx_v_m;
    __pyx_t_180 = 2;
    __pyx_t_181 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_178 * __pyx_v_J.strides[0]) ) + __pyx_t_179 * __pyx_v_J.strides[1]) ) + __pyx_t_180 * __pyx_v_J.strides[2]) ) + __pyx_t_181 * __pyx_v_J.strides[3]) )) = __pyx_v_tA;

    /* "pyross/inference.pyx":4265
 *             J[5, m, 1, m] = tE
 *             J[5, m, 2, m] = tA
 *             J[5, m, 3, m] = tIa             # <<<<<<<<<<<<<<
 *             J[5, m, 4, m] = tIs - (1-ars[m])*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 *             J[5, m, 5, m] = ars[m]*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 */
    __pyx_t_182 = 5;
    __pyx_t_183 = __pyx_v_m;
    __pyx_t_184 = 3;
    __pyx_t_185 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_182 * __pyx_v_J.strides[0]) ) + __pyx_t_183 * __pyx_v_J.strides[1]) ) + __pyx_t_184 * __pyx_v_J.strides[2]) ) + __pyx_t_185 * __pyx_v_J.strides[3]) )) = __pyx_v_tIa;

    /* "pyross/inference.pyx":4266
 *             J[5, m, 2, m] = tA
 *             J[5, m, 3, m] = tIa
 *             J[5, m, 4, m] = tIs - (1-ars[m])*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])             # <<<<<<<<<<<<<<
 *             J[5, m, 5, m] = ars[m]*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 *         self.J_mat = self.J.reshape((dim, dim))
 */
    __pyx_t_186 = __pyx_v_m;
    __pyx_t_187 = __pyx_v_m;
    __pyx_t_188 = __pyx_v_m;
    __pyx_t_189 = __pyx_v_m;
    __pyx_t_190 = __pyx_v_m;
    __pyx_t_191 = 5;
    __pyx_t_192 = __pyx_v_m;
    __pyx_t_193 = 4;
    __pyx_t_194 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_191 * __pyx_v_J.strides[0]) ) + __pyx_t_192 * __pyx_v_J.strides[1]) ) + __pyx_t_193 * __pyx_v_J.strides[2]) ) + __pyx_t_194 * __pyx_v_J.strides[3]) )) = (__pyx_v_tIs - (((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_186 * __pyx_v_ars.strides[0]) )))) * __pyx_v_t0) * ((((__pyx_v_tE * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_187 * __pyx_v_e.strides[0]) )))) + (__pyx_v_tA * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_188 * __pyx_v_a.strides[0]) ))))) + (__pyx_v_tIa * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_189 * __pyx_v_Ia.strides[0]) ))))) + (__pyx_v_tIs * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_190 * __pyx_v_Is.strides[0]) )))))));

    /* "pyross/inference.pyx":4267
 *             J[5, m, 3, m] = tIa
 *             J[5, m, 4, m] = tIs - (1-ars[m])*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 *             J[5, m, 5, m] = ars[m]*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])             # <<<<<<<<<<<<<<
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 */
    __pyx_t_195 = __pyx_v_m;
    __pyx_t_196 = __pyx_v_m;
    __pyx_t_197 = __pyx_v_m;
    __pyx_t_198 = __pyx_v_m;
    __pyx_t_199 = __pyx_v_m;
    __pyx_t_200 = 5;
    __pyx_t_201 = __pyx_v_m;
    __pyx_t_202 = 5;
    __pyx_t_203 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_200 * __pyx_v_J.strides[0]) ) + __pyx_t_201 * __pyx_v_J.strides[1]) ) + __pyx_t_202 * __pyx_v_J.strides[2]) ) + __pyx_t_203 * __pyx_v_J.strides[3]) )) = (((*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_195 * __pyx_v_ars.strides[0]) ))) * __pyx_v_t0) * ((((__pyx_v_tE * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_196 * __pyx_v_e.strides[0]) )))) + (__pyx_v_tA * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_197 * __pyx_v_a.strides[0]) ))))) + (__pyx_v_tIa * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_198 * __pyx_v_Ia.strides[0]) ))))) + (__pyx_v_tIs * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_199 * __pyx_v_Is.strides[0]) ))))));
  }

  /* "pyross/inference.pyx":4268
 *             J[5, m, 4, m] = tIs - (1-ars[m])*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 *             J[5, m, 5, m] = ars[m]*t0*(tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m])
 *         self.J_mat = self.J.reshape((dim, dim))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.J), __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_204 = PyTuple_New(2); if (unlikely(!__pyx_t_204)) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_204);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_204, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_204, 1, __pyx_t_13);
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_13 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_10 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_204) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_204);
  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_204); __pyx_t_204 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_10);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __pyx_v_self->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pyross/inference.pyx":4223
 *                 l[m] += beta[m]*CM[m,n]*(Ia[n]+a[n]+fsa[n]*Is[n])/fi[n]
 * 
 *     cdef jacobian(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, n, M=self.M, dim=self.dim
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_204);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_gE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gA, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fsa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ars, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_kapE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4271
 * 
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

static PyObject *__pyx_f_6pyross_9inference_14SEAIRQ_testing_noise_correlation(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, __Pyx_memviewslice __pyx_v_s, __Pyx_memviewslice __pyx_v_e, __Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_Ia, __Pyx_memviewslice __pyx_v_Is, __Pyx_memviewslice __pyx_v_q, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_TR) {
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_M;
  double __pyx_v_Omega;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_beta = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIa = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gIs = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gE = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_gA = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ars = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_kapE = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_tE;
  double __pyx_v_tA;
  double __pyx_v_tIa;
  double __pyx_v_tIs;
  __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_balpha = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_B = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_t0 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  double __pyx_t_2;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  PyObject *__pyx_t_117 = NULL;
  __Pyx_RefNannySetupContext("noise_correlation", 0);

  /* "pyross/inference.pyx":4273
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):
 *         cdef:
 *             Py_ssize_t m, M=self.M             # <<<<<<<<<<<<<<
 *             double Omega=self.Omega
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":4274
 *         cdef:
 *             Py_ssize_t m, M=self.M
 *             double Omega=self.Omega             # <<<<<<<<<<<<<<
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA
 *             double [:] ars=self.ars, kapE=self.kapE
 */
  __pyx_t_2 = __pyx_v_self->__pyx_base.Omega;
  __pyx_v_Omega = __pyx_t_2;

  /* "pyross/inference.pyx":4275
 *             Py_ssize_t m, M=self.M
 *             double Omega=self.Omega
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA             # <<<<<<<<<<<<<<
 *             double [:] ars=self.ars, kapE=self.kapE
 *             double tE, tA, tIa, tIs
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.beta), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4275, __pyx_L1_error)
  __pyx_v_beta = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIa), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4275, __pyx_L1_error)
  __pyx_v_gIa = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.gIs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4275, __pyx_L1_error)
  __pyx_v_gIs = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4275, __pyx_L1_error)
  __pyx_v_gE = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->gA), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4275, __pyx_L1_error)
  __pyx_v_gA = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4276
 *             double Omega=self.Omega
 *             double [:] beta=self.beta, gIa=self.gIa, gIs=self.gIs, gE=self.gE, gA=self.gA
 *             double [:] ars=self.ars, kapE=self.kapE             # <<<<<<<<<<<<<<
 *             double tE, tA, tIa, tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->ars), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4276, __pyx_L1_error)
  __pyx_v_ars = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->kapE), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4276, __pyx_L1_error)
  __pyx_v_kapE = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4278
 *             double [:] ars=self.ars, kapE=self.kapE
 *             double tE, tA, tIa, tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.alpha), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4278, __pyx_L1_error)
  __pyx_v_alpha = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;
  __pyx_t_4 = PyNumber_Subtract(__pyx_int_1, ((PyObject *)__pyx_v_self->__pyx_base.alpha)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_balpha = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4279
 *             double tE, tA, tIa, tIs
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B             # <<<<<<<<<<<<<<
 *         for m in range(M): # only fill in the upper triangular form
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.B), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4279, __pyx_L1_error)
  __pyx_v_B = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4280
 *             double [:] alpha=self.alpha, balpha=1-self.alpha
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_6 = __pyx_t_1;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_m = __pyx_t_7;

    /* "pyross/inference.pyx":4281
 *             double [:, :, :, :] B = self.B
 *         for m in range(M): # only fill in the upper triangular form
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])             # <<<<<<<<<<<<<<
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 *             tA= TR[m]*ars[m]*t0/Omega
 */
    __pyx_t_8 = __pyx_v_m;
    __pyx_t_4 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_8 * __pyx_v_ars.strides[0]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_v_m, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __pyx_v_m;
    __pyx_t_11 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_q.data + __pyx_t_10 * __pyx_v_q.strides[0]) )))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = PyNumber_Subtract(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_13 = __pyx_v_m;
    __pyx_t_11 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_13 * __pyx_v_Is.strides[0]) )))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = PyNumber_Subtract(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_14 = __pyx_v_m;
    __pyx_t_9 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_14 * __pyx_v_Is.strides[0]) )))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyNumber_Add(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_, __pyx_t_4, 1., 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_t0, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "pyross/inference.pyx":4282
 *         for m in range(M): # only fill in the upper triangular form
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega             # <<<<<<<<<<<<<<
 *             tA= TR[m]*ars[m]*t0/Omega
 *             tIa = TR[m]*ars[m]*t0/Omega
 */
    __pyx_t_15 = __pyx_v_m;
    __pyx_t_16 = __pyx_v_m;
    __pyx_t_17 = __pyx_v_m;
    __pyx_t_9 = PyFloat_FromDouble((((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_15 * __pyx_v_TR.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_16 * __pyx_v_ars.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_kapE.data + __pyx_t_17 * __pyx_v_kapE.strides[0]) ))))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_9, __pyx_v_t0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_Omega); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_tE = __pyx_t_2;

    /* "pyross/inference.pyx":4283
 *             t0 = 1./(ars[m]*(self.fi[m]-q[m]-Is[m])+Is[m])
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 *             tA= TR[m]*ars[m]*t0/Omega             # <<<<<<<<<<<<<<
 *             tIa = TR[m]*ars[m]*t0/Omega
 *             tIs = TR[m]*t0/Omega
 */
    __pyx_t_18 = __pyx_v_m;
    __pyx_t_19 = __pyx_v_m;
    __pyx_t_11 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_18 * __pyx_v_TR.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_19 * __pyx_v_ars.strides[0]) ))))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_11, __pyx_v_t0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_Omega); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_tA = __pyx_t_2;

    /* "pyross/inference.pyx":4284
 *             tE = TR[m]*ars[m]*kapE[m]*t0/Omega
 *             tA= TR[m]*ars[m]*t0/Omega
 *             tIa = TR[m]*ars[m]*t0/Omega             # <<<<<<<<<<<<<<
 *             tIs = TR[m]*t0/Omega
 * 
 */
    __pyx_t_20 = __pyx_v_m;
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_4 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_20 * __pyx_v_TR.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_ars.data + __pyx_t_21 * __pyx_v_ars.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyNumber_Multiply(__pyx_t_4, __pyx_v_t0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4284, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_tIa = __pyx_t_2;

    /* "pyross/inference.pyx":4285
 *             tA= TR[m]*ars[m]*t0/Omega
 *             tIa = TR[m]*ars[m]*t0/Omega
 *             tIs = TR[m]*t0/Omega             # <<<<<<<<<<<<<<
 * 
 *             B[0, m, 0, m] = l[m]*s[m]
 */
    __pyx_t_22 = __pyx_v_m;
    __pyx_t_9 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_TR.data + __pyx_t_22 * __pyx_v_TR.strides[0]) )))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_9, __pyx_v_t0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_Omega); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_tIs = __pyx_t_2;

    /* "pyross/inference.pyx":4287
 *             tIs = TR[m]*t0/Omega
 * 
 *             B[0, m, 0, m] = l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE)*e[m]
 */
    __pyx_t_23 = __pyx_v_m;
    __pyx_t_24 = __pyx_v_m;
    __pyx_t_25 = 0;
    __pyx_t_26 = __pyx_v_m;
    __pyx_t_27 = 0;
    __pyx_t_28 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_25 * __pyx_v_B.strides[0]) ) + __pyx_t_26 * __pyx_v_B.strides[1]) ) + __pyx_t_27 * __pyx_v_B.strides[2]) ) + __pyx_t_28 * __pyx_v_B.strides[3]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_23 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_24 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":4288
 * 
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE)*e[m]
 *             B[1, m, 2, m] = -gE[m]*e[m]
 */
    __pyx_t_29 = __pyx_v_m;
    __pyx_t_30 = __pyx_v_m;
    __pyx_t_31 = 0;
    __pyx_t_32 = __pyx_v_m;
    __pyx_t_33 = 1;
    __pyx_t_34 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_31 * __pyx_v_B.strides[0]) ) + __pyx_t_32 * __pyx_v_B.strides[1]) ) + __pyx_t_33 * __pyx_v_B.strides[2]) ) + __pyx_t_34 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_29 * __pyx_v_l.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_30 * __pyx_v_s.strides[0]) ))));

    /* "pyross/inference.pyx":4289
 *             B[0, m, 0, m] = l[m]*s[m]
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE)*e[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 2, m] = -gE[m]*e[m]
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA)*a[m]
 */
    __pyx_t_35 = __pyx_v_m;
    __pyx_t_36 = __pyx_v_m;
    __pyx_t_37 = __pyx_v_m;
    __pyx_t_38 = __pyx_v_m;
    __pyx_t_39 = 1;
    __pyx_t_40 = __pyx_v_m;
    __pyx_t_41 = 1;
    __pyx_t_42 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_39 * __pyx_v_B.strides[0]) ) + __pyx_t_40 * __pyx_v_B.strides[1]) ) + __pyx_t_41 * __pyx_v_B.strides[2]) ) + __pyx_t_42 * __pyx_v_B.strides[3]) )) = (((*((double *) ( /* dim=0 */ (__pyx_v_l.data + __pyx_t_35 * __pyx_v_l.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_36 * __pyx_v_s.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_37 * __pyx_v_gE.strides[0]) ))) + __pyx_v_tE) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_38 * __pyx_v_e.strides[0]) )))));

    /* "pyross/inference.pyx":4290
 *             B[0, m, 1, m] =  - l[m]*s[m]
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE)*e[m]
 *             B[1, m, 2, m] = -gE[m]*e[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA)*a[m]
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 */
    __pyx_t_43 = __pyx_v_m;
    __pyx_t_44 = __pyx_v_m;
    __pyx_t_45 = 1;
    __pyx_t_46 = __pyx_v_m;
    __pyx_t_47 = 2;
    __pyx_t_48 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_45 * __pyx_v_B.strides[0]) ) + __pyx_t_46 * __pyx_v_B.strides[1]) ) + __pyx_t_47 * __pyx_v_B.strides[2]) ) + __pyx_t_48 * __pyx_v_B.strides[3]) )) = ((-(*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_43 * __pyx_v_gE.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_44 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":4291
 *             B[1, m, 1, m] = l[m]*s[m] + (gE[m]+tE)*e[m]
 *             B[1, m, 2, m] = -gE[m]*e[m]
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA)*a[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 */
    __pyx_t_49 = __pyx_v_m;
    __pyx_t_50 = __pyx_v_m;
    __pyx_t_51 = __pyx_v_m;
    __pyx_t_52 = __pyx_v_m;
    __pyx_t_53 = 2;
    __pyx_t_54 = __pyx_v_m;
    __pyx_t_55 = 2;
    __pyx_t_56 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_53 * __pyx_v_B.strides[0]) ) + __pyx_t_54 * __pyx_v_B.strides[1]) ) + __pyx_t_55 * __pyx_v_B.strides[2]) ) + __pyx_t_56 * __pyx_v_B.strides[3]) )) = (((*((double *) ( /* dim=0 */ (__pyx_v_gE.data + __pyx_t_49 * __pyx_v_gE.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_50 * __pyx_v_e.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_51 * __pyx_v_gA.strides[0]) ))) + __pyx_v_tA) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_52 * __pyx_v_a.strides[0]) )))));

    /* "pyross/inference.pyx":4292
 *             B[1, m, 2, m] = -gE[m]*e[m]
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA)*a[m]
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa)*Ia[m]
 */
    __pyx_t_57 = __pyx_v_m;
    __pyx_t_58 = __pyx_v_m;
    __pyx_t_59 = __pyx_v_m;
    __pyx_t_60 = 2;
    __pyx_t_61 = __pyx_v_m;
    __pyx_t_62 = 3;
    __pyx_t_63 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_60 * __pyx_v_B.strides[0]) ) + __pyx_t_61 * __pyx_v_B.strides[1]) ) + __pyx_t_62 * __pyx_v_B.strides[2]) ) + __pyx_t_63 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_57 * __pyx_v_alpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_58 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_59 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4293
 *             B[2, m, 2, m] = gE[m]*e[m]+(gA[m]+tA)*a[m]
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]             # <<<<<<<<<<<<<<
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa)*Ia[m]
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs)*Is[m]
 */
    __pyx_t_64 = __pyx_v_m;
    __pyx_t_65 = __pyx_v_m;
    __pyx_t_66 = __pyx_v_m;
    __pyx_t_67 = 2;
    __pyx_t_68 = __pyx_v_m;
    __pyx_t_69 = 4;
    __pyx_t_70 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_67 * __pyx_v_B.strides[0]) ) + __pyx_t_68 * __pyx_v_B.strides[1]) ) + __pyx_t_69 * __pyx_v_B.strides[2]) ) + __pyx_t_70 * __pyx_v_B.strides[3]) )) = (((-(*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_64 * __pyx_v_balpha.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_65 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_66 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4294
 *             B[2, m, 3, m] = -alpha[m]*gA[m]*a[m]
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa)*Ia[m]             # <<<<<<<<<<<<<<
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs)*Is[m]
 *             B[1, m, 5, m] = -tE*e[m]
 */
    __pyx_t_71 = __pyx_v_m;
    __pyx_t_72 = __pyx_v_m;
    __pyx_t_73 = __pyx_v_m;
    __pyx_t_74 = __pyx_v_m;
    __pyx_t_75 = __pyx_v_m;
    __pyx_t_76 = 3;
    __pyx_t_77 = __pyx_v_m;
    __pyx_t_78 = 3;
    __pyx_t_79 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_76 * __pyx_v_B.strides[0]) ) + __pyx_t_77 * __pyx_v_B.strides[1]) ) + __pyx_t_78 * __pyx_v_B.strides[2]) ) + __pyx_t_79 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_71 * __pyx_v_alpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_72 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_73 * __pyx_v_a.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gIa.data + __pyx_t_74 * __pyx_v_gIa.strides[0]) ))) + __pyx_v_tIa) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_75 * __pyx_v_Ia.strides[0]) )))));

    /* "pyross/inference.pyx":4295
 *             B[2, m, 4, m] = -balpha[m]*gA[m]*a[m]
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa)*Ia[m]
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs)*Is[m]             # <<<<<<<<<<<<<<
 *             B[1, m, 5, m] = -tE*e[m]
 *             B[2, m, 5, m] = -tA*a[m]
 */
    __pyx_t_80 = __pyx_v_m;
    __pyx_t_81 = __pyx_v_m;
    __pyx_t_82 = __pyx_v_m;
    __pyx_t_83 = __pyx_v_m;
    __pyx_t_84 = __pyx_v_m;
    __pyx_t_85 = 4;
    __pyx_t_86 = __pyx_v_m;
    __pyx_t_87 = 4;
    __pyx_t_88 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_85 * __pyx_v_B.strides[0]) ) + __pyx_t_86 * __pyx_v_B.strides[1]) ) + __pyx_t_87 * __pyx_v_B.strides[2]) ) + __pyx_t_88 * __pyx_v_B.strides[3]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_balpha.data + __pyx_t_80 * __pyx_v_balpha.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_gA.data + __pyx_t_81 * __pyx_v_gA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_82 * __pyx_v_a.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_gIs.data + __pyx_t_83 * __pyx_v_gIs.strides[0]) ))) + __pyx_v_tIs) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_84 * __pyx_v_Is.strides[0]) )))));

    /* "pyross/inference.pyx":4296
 *             B[3, m, 3, m] = alpha[m]*gA[m]*a[m]+(gIa[m]+tIa)*Ia[m]
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs)*Is[m]
 *             B[1, m, 5, m] = -tE*e[m]             # <<<<<<<<<<<<<<
 *             B[2, m, 5, m] = -tA*a[m]
 *             B[3, m, 5, m] = -tIa*Ia[m]
 */
    __pyx_t_89 = __pyx_v_m;
    __pyx_t_90 = 1;
    __pyx_t_91 = __pyx_v_m;
    __pyx_t_92 = 5;
    __pyx_t_93 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_90 * __pyx_v_B.strides[0]) ) + __pyx_t_91 * __pyx_v_B.strides[1]) ) + __pyx_t_92 * __pyx_v_B.strides[2]) ) + __pyx_t_93 * __pyx_v_B.strides[3]) )) = ((-__pyx_v_tE) * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_89 * __pyx_v_e.strides[0]) ))));

    /* "pyross/inference.pyx":4297
 *             B[4, m, 4, m] = balpha[m]*gA[m]*a[m] + (gIs[m]+tIs)*Is[m]
 *             B[1, m, 5, m] = -tE*e[m]
 *             B[2, m, 5, m] = -tA*a[m]             # <<<<<<<<<<<<<<
 *             B[3, m, 5, m] = -tIa*Ia[m]
 *             B[4, m, 5, m] = -tIs*Is[m]
 */
    __pyx_t_94 = __pyx_v_m;
    __pyx_t_95 = 2;
    __pyx_t_96 = __pyx_v_m;
    __pyx_t_97 = 5;
    __pyx_t_98 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_95 * __pyx_v_B.strides[0]) ) + __pyx_t_96 * __pyx_v_B.strides[1]) ) + __pyx_t_97 * __pyx_v_B.strides[2]) ) + __pyx_t_98 * __pyx_v_B.strides[3]) )) = ((-__pyx_v_tA) * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_94 * __pyx_v_a.strides[0]) ))));

    /* "pyross/inference.pyx":4298
 *             B[1, m, 5, m] = -tE*e[m]
 *             B[2, m, 5, m] = -tA*a[m]
 *             B[3, m, 5, m] = -tIa*Ia[m]             # <<<<<<<<<<<<<<
 *             B[4, m, 5, m] = -tIs*Is[m]
 *             B[5, m, 5, m] = tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m]
 */
    __pyx_t_99 = __pyx_v_m;
    __pyx_t_100 = 3;
    __pyx_t_101 = __pyx_v_m;
    __pyx_t_102 = 5;
    __pyx_t_103 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_100 * __pyx_v_B.strides[0]) ) + __pyx_t_101 * __pyx_v_B.strides[1]) ) + __pyx_t_102 * __pyx_v_B.strides[2]) ) + __pyx_t_103 * __pyx_v_B.strides[3]) )) = ((-__pyx_v_tIa) * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_99 * __pyx_v_Ia.strides[0]) ))));

    /* "pyross/inference.pyx":4299
 *             B[2, m, 5, m] = -tA*a[m]
 *             B[3, m, 5, m] = -tIa*Ia[m]
 *             B[4, m, 5, m] = -tIs*Is[m]             # <<<<<<<<<<<<<<
 *             B[5, m, 5, m] = tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 */
    __pyx_t_104 = __pyx_v_m;
    __pyx_t_105 = 4;
    __pyx_t_106 = __pyx_v_m;
    __pyx_t_107 = 5;
    __pyx_t_108 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_105 * __pyx_v_B.strides[0]) ) + __pyx_t_106 * __pyx_v_B.strides[1]) ) + __pyx_t_107 * __pyx_v_B.strides[2]) ) + __pyx_t_108 * __pyx_v_B.strides[3]) )) = ((-__pyx_v_tIs) * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_104 * __pyx_v_Is.strides[0]) ))));

    /* "pyross/inference.pyx":4300
 *             B[3, m, 5, m] = -tIa*Ia[m]
 *             B[4, m, 5, m] = -tIs*Is[m]
 *             B[5, m, 5, m] = tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m]             # <<<<<<<<<<<<<<
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 * 
 */
    __pyx_t_109 = __pyx_v_m;
    __pyx_t_110 = __pyx_v_m;
    __pyx_t_111 = __pyx_v_m;
    __pyx_t_112 = __pyx_v_m;
    __pyx_t_113 = 5;
    __pyx_t_114 = __pyx_v_m;
    __pyx_t_115 = 5;
    __pyx_t_116 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_113 * __pyx_v_B.strides[0]) ) + __pyx_t_114 * __pyx_v_B.strides[1]) ) + __pyx_t_115 * __pyx_v_B.strides[2]) ) + __pyx_t_116 * __pyx_v_B.strides[3]) )) = ((((__pyx_v_tE * (*((double *) ( /* dim=0 */ (__pyx_v_e.data + __pyx_t_109 * __pyx_v_e.strides[0]) )))) + (__pyx_v_tA * (*((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_110 * __pyx_v_a.strides[0]) ))))) + (__pyx_v_tIa * (*((double *) ( /* dim=0 */ (__pyx_v_Ia.data + __pyx_t_111 * __pyx_v_Ia.strides[0]) ))))) + (__pyx_v_tIs * (*((double *) ( /* dim=0 */ (__pyx_v_Is.data + __pyx_t_112 * __pyx_v_Is.strides[0]) )))));
  }

  /* "pyross/inference.pyx":4301
 *             B[4, m, 5, m] = -tIs*Is[m]
 *             B[5, m, 5, m] = tE*e[m]+tA*a[m]+tIa*Ia[m]+tIs*Is[m]
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.B), __pyx_n_s_reshape); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_117 = PyTuple_New(2); if (unlikely(!__pyx_t_117)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_117);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_117, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_117, 1, __pyx_t_12);
  __pyx_t_4 = 0;
  __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_117) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_117);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_117); __pyx_t_117 = 0;
  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __pyx_t_117 = __Pyx_PyObject_GetItem(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_117)) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_117);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_117) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_117, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4301, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_117);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __pyx_v_self->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_117);
  __pyx_t_117 = 0;

  /* "pyross/inference.pyx":4271
 * 
 * 
 *     cdef noise_correlation(self, double [:] s, double [:] e, double [:] a, double [:] Ia, double [:] Is, double [:] q, double [:] l, double [:] TR):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t m, M=self.M
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_117);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.noise_correlation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_beta, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIa, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gIs, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_gA, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ars, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_kapE, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_balpha, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_B, 1);
  __Pyx_XDECREF(__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4150
 * 
 *     cdef:
 *         readonly np.ndarray gE, gA, ars, kapE             # <<<<<<<<<<<<<<
 *         readonly object testRate
 *         readonly pyross.deterministic.SEAIRQ_testing det_model
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_2gE_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_2gE_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_2gE___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_2gE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gE));
  __pyx_r = ((PyObject *)__pyx_v_self->gE);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_2gA_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_2gA_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_2gA___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_2gA___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gA));
  __pyx_r = ((PyObject *)__pyx_v_self->gA);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_3ars_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_3ars_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_3ars___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_3ars___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->ars));
  __pyx_r = ((PyObject *)__pyx_v_self->ars);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_4kapE_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_4kapE_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_4kapE___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_4kapE___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->kapE));
  __pyx_r = ((PyObject *)__pyx_v_self->kapE);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4151
 *     cdef:
 *         readonly np.ndarray gE, gA, ars, kapE
 *         readonly object testRate             # <<<<<<<<<<<<<<
 *         readonly pyross.deterministic.SEAIRQ_testing det_model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_8testRate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_8testRate_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_8testRate___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_8testRate___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __pyx_r = __pyx_v_self->testRate;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4152
 *         readonly np.ndarray gE, gA, ars, kapE
 *         readonly object testRate
 *         readonly pyross.deterministic.SEAIRQ_testing det_model             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, parameters, testRate, M, fi, Omega=1, steps=4, det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_9det_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_9det_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_9det_model___get__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_9det_model___get__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_r = ((PyObject *)__pyx_v_self->det_model);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_12__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_12__reduce_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.ars, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.kapE, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(40); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->ars));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->ars));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->ars));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 12, ((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 13, __pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 14, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_v_self->__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 17, ((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gA));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gA));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->gA));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->gE));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->gE));
  PyTuple_SET_ITEM(__pyx_t_10, 26, ((PyObject *)__pyx_v_self->gE));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 27, ((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 28, ((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->kapE));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->kapE));
  PyTuple_SET_ITEM(__pyx_t_10, 29, ((PyObject *)__pyx_v_self->kapE));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 30, __pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 33, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 34, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 35, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 36, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 37, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __Pyx_GIVEREF(__pyx_v_self->testRate);
  PyTuple_SET_ITEM(__pyx_t_10, 38, __pyx_v_self->testRate);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 39, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.ars, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.kapE, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.ars, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.kapE, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.ars is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.kapE is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.testRate is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.ars, self.beta, self.class_index_dict, self.cols, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gA, self.gE, self.gIa, self.gIs, self.kapE, self.lyapunov_method, self.nClass, self.param_keys, self.param_mapping_enabled, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.ars is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.kapE is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.testRate is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->ars) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.beta) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.cols) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.contactMatrix != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.dsigmadt) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.fi) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices1) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices2) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.fsa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->gA) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->gE) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.gIa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.gIs) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->kapE) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.rows) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->testRate != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.ars is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.kapE is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.testRate is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.ars is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.kapE is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.testRate is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SEAIRQ_testing); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_23253038);
    __Pyx_GIVEREF(__pyx_int_23253038);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_23253038);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.ars is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gA is not None or self.gE is not None or self.gIa is not None or self.gIs is not None or self.kapE is not None or self.lyapunov_method is not None or self.param_keys is not None or self.rows is not None or self.testRate is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, None), state
 *     else:
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SEAIRQ_testing__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SEAIRQ_testing); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_23253038);
    __Pyx_GIVEREF(__pyx_int_23253038);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_23253038);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SEAIRQ_testing__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_14SEAIRQ_testing_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_14SEAIRQ_testing_14__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14SEAIRQ_testing_14__setstate_cython__(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SEAIRQ_testing__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ_testing__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SEAIRQ_testing, (type(self), 0x162d02e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SEAIRQ_testing__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SEAIRQ_testing.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4386
 * 
 * 
 *     def __init__(self, model_spec, parameters, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_3Spp_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_3Spp_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_model_spec = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  PyObject *__pyx_v_parameter_mapping = 0;
  PyObject *__pyx_v_time_dep_param_mapping = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_model_spec,&__pyx_n_s_parameters,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,&__pyx_n_s_parameter_mapping,&__pyx_n_s_time_dep_param_mapping,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_1);
    values[5] = ((PyObject *)__pyx_int_4);
    values[6] = ((PyObject *)__pyx_n_u_LSODA);
    values[7] = ((PyObject *)__pyx_n_u_LSODA);
    values[8] = ((PyObject *)__pyx_float_1eneg_3);
    values[9] = ((PyObject *)__pyx_float_1eneg_3);

    /* "pyross/inference.pyx":4387
 * 
 *     def __init__(self, model_spec, parameters, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):             # <<<<<<<<<<<<<<
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 */
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model_spec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 12, 1); __PYX_ERR(0, 4386, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 12, 2); __PYX_ERR(0, 4386, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 12, 3); __PYX_ERR(0, 4386, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameter_mapping);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_time_dep_param_mapping);
          if (value) { values[11] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 4386, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_model_spec = values[0];
    __pyx_v_parameters = values[1];
    __pyx_v_M = values[2];
    __pyx_v_fi = values[3];
    __pyx_v_Omega = values[4];
    __pyx_v_steps = values[5];
    __pyx_v_det_method = values[6];
    __pyx_v_lyapunov_method = values[7];
    __pyx_v_rtol_det = values[8];
    __pyx_v_rtol_lyapunov = values[9];
    __pyx_v_parameter_mapping = values[10];
    __pyx_v_time_dep_param_mapping = values[11];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.Spp.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp___init__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self), __pyx_v_model_spec, __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov, __pyx_v_parameter_mapping, __pyx_v_time_dep_param_mapping);

  /* "pyross/inference.pyx":4386
 * 
 * 
 *     def __init__(self, model_spec, parameters, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_3Spp___init__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping) {
  PyObject *__pyx_v_res = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_ndx = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_parameters);

  /* "pyross/inference.pyx":4388
 *     def __init__(self, model_spec, parameters, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping
 */
  __pyx_t_2 = (__pyx_v_parameter_mapping != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_time_dep_param_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pyross/inference.pyx":4389
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')             # <<<<<<<<<<<<<<
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 4389, __pyx_L1_error)

    /* "pyross/inference.pyx":4388
 *     def __init__(self, model_spec, parameters, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping
 */
  }

  /* "pyross/inference.pyx":4390
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping             # <<<<<<<<<<<<<<
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())
 */
  __Pyx_INCREF(__pyx_v_parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_parameter_mapping);
  __Pyx_GOTREF(__pyx_v_self->parameter_mapping);
  __Pyx_DECREF(__pyx_v_self->parameter_mapping);
  __pyx_v_self->parameter_mapping = __pyx_v_parameter_mapping;

  /* "pyross/inference.pyx":4391
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping             # <<<<<<<<<<<<<<
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:
 */
  __Pyx_INCREF(__pyx_v_time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_time_dep_param_mapping);
  __Pyx_GOTREF(__pyx_v_self->time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v_self->time_dep_param_mapping);
  __pyx_v_self->time_dep_param_mapping = __pyx_v_time_dep_param_mapping;

  /* "pyross/inference.pyx":4392
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())             # <<<<<<<<<<<<<<
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_parameters, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.param_keys);
  __pyx_v_self->__pyx_base.param_keys = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":4393
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:
 */
  __pyx_t_1 = (__pyx_v_parameter_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4394
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())             # <<<<<<<<<<<<<<
 *         elif time_dep_param_mapping is not None:
 *             self.param_dict = parameters.copy()
 */
    __Pyx_INCREF(__pyx_v_parameter_mapping);
    __pyx_t_6 = __pyx_v_parameter_mapping; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_keys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PySequence_List(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->model_param_keys);
    __Pyx_DECREF(__pyx_v_self->model_param_keys);
    __pyx_v_self->model_param_keys = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":4393
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:
 */
    goto __pyx_L6;
  }

  /* "pyross/inference.pyx":4395
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.param_dict = parameters.copy()
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 */
  __pyx_t_2 = (__pyx_v_time_dep_param_mapping != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4396
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:
 *             self.param_dict = parameters.copy()             # <<<<<<<<<<<<<<
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 *         else:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_parameters, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 4396, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->param_dict);
    __Pyx_DECREF(__pyx_v_self->param_dict);
    __pyx_v_self->param_dict = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":4397
 *         elif time_dep_param_mapping is not None:
 *             self.param_dict = parameters.copy()
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())             # <<<<<<<<<<<<<<
 *         else:
 *             self.model_param_keys = self.param_keys.copy()
 */
    __Pyx_INCREF(__pyx_v_time_dep_param_mapping);
    __pyx_t_4 = __pyx_v_time_dep_param_mapping; __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_parameters, __pyx_int_0};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4397, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_parameters, __pyx_int_0};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4397, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_parameters);
      __Pyx_GIVEREF(__pyx_v_parameters);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_parameters);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_int_0);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_List(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->model_param_keys);
    __Pyx_DECREF(__pyx_v_self->model_param_keys);
    __pyx_v_self->model_param_keys = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":4395
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.param_dict = parameters.copy()
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 */
    goto __pyx_L6;
  }

  /* "pyross/inference.pyx":4399
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 *         else:
 *             self.model_param_keys = self.param_keys.copy()             # <<<<<<<<<<<<<<
 *         self.model_spec=model_spec
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.param_keys, __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 4399, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->model_param_keys);
    __Pyx_DECREF(__pyx_v_self->model_param_keys);
    __pyx_v_self->model_param_keys = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L6:;

  /* "pyross/inference.pyx":4400
 *         else:
 *             self.model_param_keys = self.param_keys.copy()
 *         self.model_spec=model_spec             # <<<<<<<<<<<<<<
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 *         self.nClass = res[0]
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_model_spec))||((__pyx_v_model_spec) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_model_spec)->tp_name), 0))) __PYX_ERR(0, 4400, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_model_spec;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->model_spec);
  __Pyx_DECREF(__pyx_v_self->model_spec);
  __pyx_v_self->model_spec = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4401
 *             self.model_param_keys = self.param_keys.copy()
 *         self.model_spec=model_spec
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)             # <<<<<<<<<<<<<<
 *         self.nClass = res[0]
 *         self.class_index_dict = res[1]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyross); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_model_spec); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_model_spec, __pyx_v_self->model_param_keys};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4401, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_model_spec, __pyx_v_self->model_param_keys};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4401, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_self->model_param_keys);
    __Pyx_GIVEREF(__pyx_v_self->model_param_keys);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_self->model_param_keys);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_res = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4402
 *         self.model_spec=model_spec
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 *         self.nClass = res[0]             # <<<<<<<<<<<<<<
 *         self.class_index_dict = res[1]
 *         self.constant_terms = res[2]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_self->__pyx_base.nClass = __pyx_t_10;

  /* "pyross/inference.pyx":4403
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 *         self.nClass = res[0]
 *         self.class_index_dict = res[1]             # <<<<<<<<<<<<<<
 *         self.constant_terms = res[2]
 *         self.linear_terms = res[3]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 4403, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.class_index_dict);
  __pyx_v_self->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4404
 *         self.nClass = res[0]
 *         self.class_index_dict = res[1]
 *         self.constant_terms = res[2]             # <<<<<<<<<<<<<<
 *         self.linear_terms = res[3]
 *         self.infection_terms = res[4]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4404, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->constant_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->constant_terms));
  __pyx_v_self->constant_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4405
 *         self.class_index_dict = res[1]
 *         self.constant_terms = res[2]
 *         self.linear_terms = res[3]             # <<<<<<<<<<<<<<
 *         self.infection_terms = res[4]
 *         self.finres_terms = res[5]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4405, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->linear_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->linear_terms));
  __pyx_v_self->linear_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4406
 *         self.constant_terms = res[2]
 *         self.linear_terms = res[3]
 *         self.infection_terms = res[4]             # <<<<<<<<<<<<<<
 *         self.finres_terms = res[5]
 *         self.resource_list = res[6]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4406, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->infection_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->infection_terms));
  __pyx_v_self->infection_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4407
 *         self.linear_terms = res[3]
 *         self.infection_terms = res[4]
 *         self.finres_terms = res[5]             # <<<<<<<<<<<<<<
 *         self.resource_list = res[6]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4407, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->finres_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->finres_terms));
  __pyx_v_self->finres_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4408
 *         self.infection_terms = res[4]
 *         self.finres_terms = res[5]
 *         self.resource_list = res[6]             # <<<<<<<<<<<<<<
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4408, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->resource_list);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->resource_list));
  __pyx_v_self->resource_list = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4409
 *         self.finres_terms = res[5]
 *         self.resource_list = res[6]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_Spp));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_Spp));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_Spp));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_init); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[11] = {__pyx_t_5, __pyx_v_parameters, __pyx_t_9, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 10+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4409, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[11] = {__pyx_t_5, __pyx_v_parameters, __pyx_t_9, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 10+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4409, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(10+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_7, 5+__pyx_t_8, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_7, 6+__pyx_t_8, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_7, 7+__pyx_t_8, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_7, 8+__pyx_t_8, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_7, 9+__pyx_t_8, __pyx_v_rtol_lyapunov);
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4410
 *         self.resource_list = res[6]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 */
  __pyx_t_1 = (__pyx_v_self->parameter_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4411
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)             # <<<<<<<<<<<<<<
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:
 */
    __Pyx_INCREF(__pyx_v_self->parameter_mapping);
    __pyx_t_6 = __pyx_v_self->parameter_mapping; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_parameters, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":4412
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True             # <<<<<<<<<<<<<<
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 */
    __pyx_v_self->__pyx_base.param_mapping_enabled = 1;

    /* "pyross/inference.pyx":4410
 *         self.resource_list = res[6]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 */
  }

  /* "pyross/inference.pyx":4413
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *             self.param_mapping_enabled = True
 */
  __pyx_t_2 = (__pyx_v_self->time_dep_param_mapping != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4414
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)             # <<<<<<<<<<<<<<
 *             self.param_mapping_enabled = True
 *         else:
 */
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_fi, __pyx_v_Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_M);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_time_dep_param_mapping, __pyx_v_time_dep_param_mapping) < 0) __PYX_ERR(0, 4414, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_Spp), __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->det_model);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
    __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4415
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *             self.param_mapping_enabled = True             # <<<<<<<<<<<<<<
 *         else:
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega)
 */
    __pyx_v_self->__pyx_base.param_mapping_enabled = 1;

    /* "pyross/inference.pyx":4413
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *             self.param_mapping_enabled = True
 */
    goto __pyx_L8;
  }

  /* "pyross/inference.pyx":4417
 *             self.param_mapping_enabled = True
 *         else:
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega)             # <<<<<<<<<<<<<<
 * 
 *         self.finres_pop = np.empty( len(self.resource_list), dtype='object')  # populations for finite-resource transitions
 */
  /*else*/ {
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_fi, __pyx_v_Omega); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_M);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_Spp), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->det_model);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
    __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L8:;

  /* "pyross/inference.pyx":4419
 *             self.det_model = pyross.deterministic.Spp(model_spec, parameters, M, fi*Omega)
 * 
 *         self.finres_pop = np.empty( len(self.resource_list), dtype='object')  # populations for finite-resource transitions             # <<<<<<<<<<<<<<
 *         for i in range(len(self.resource_list)):
 *             ndx = self.resource_list[i][0]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = ((PyObject *)__pyx_v_self->resource_list);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_10 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_n_u_object) < 0) __PYX_ERR(0, 4419, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4419, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_9);
  __Pyx_GOTREF(__pyx_v_self->finres_pop);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->finres_pop));
  __pyx_v_self->finres_pop = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "pyross/inference.pyx":4420
 * 
 *         self.finres_pop = np.empty( len(self.resource_list), dtype='object')  # populations for finite-resource transitions
 *         for i in range(len(self.resource_list)):             # <<<<<<<<<<<<<<
 *             ndx = self.resource_list[i][0]
 *             if self.model_parameters_length[ndx] == 1:
 */
  __pyx_t_9 = ((PyObject *)__pyx_v_self->resource_list);
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_10 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = __pyx_t_10;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyross/inference.pyx":4421
 *         self.finres_pop = np.empty( len(self.resource_list), dtype='object')  # populations for finite-resource transitions
 *         for i in range(len(self.resource_list)):
 *             ndx = self.resource_list[i][0]             # <<<<<<<<<<<<<<
 *             if self.model_parameters_length[ndx] == 1:
 *                 self.finres_pop[i] = 0
 */
    __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->resource_list), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ndx, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4422
 *         for i in range(len(self.resource_list)):
 *             ndx = self.resource_list[i][0]
 *             if self.model_parameters_length[ndx] == 1:             # <<<<<<<<<<<<<<
 *                 self.finres_pop[i] = 0
 *             else:
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->model_parameters_length), __pyx_v_ndx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 4422, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_1) {

      /* "pyross/inference.pyx":4423
 *             ndx = self.resource_list[i][0]
 *             if self.model_parameters_length[ndx] == 1:
 *                 self.finres_pop[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 self.finres_pop[i] = np.zeros(self.M, dtype=DTYPE)
 */
      if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, __pyx_int_0, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 4423, __pyx_L1_error)

      /* "pyross/inference.pyx":4422
 *         for i in range(len(self.resource_list)):
 *             ndx = self.resource_list[i][0]
 *             if self.model_parameters_length[ndx] == 1:             # <<<<<<<<<<<<<<
 *                 self.finres_pop[i] = 0
 *             else:
 */
      goto __pyx_L11;
    }

    /* "pyross/inference.pyx":4425
 *                 self.finres_pop[i] = 0
 *             else:
 *                 self.finres_pop[i] = np.zeros(self.M, dtype=DTYPE)             # <<<<<<<<<<<<<<
 * 
 *     def infection_indices(self):
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 4425, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L11:;
  }

  /* "pyross/inference.pyx":4386
 * 
 * 
 *     def __init__(self, model_spec, parameters, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.Spp.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_ndx);
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4427
 *                 self.finres_pop[i] = np.zeros(self.M, dtype=DTYPE)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t a = 100
 *         indices = set()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_2infection_indices(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_2infection_indices(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  Py_ssize_t __pyx_v_a;
  PyObject *__pyx_v_indices = NULL;
  PyObject *__pyx_v_linear_terms_indices = NULL;
  PyObject *__pyx_v_term = NULL;
  PyObject *__pyx_v_infective_index = NULL;
  PyObject *__pyx_v_temp = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_product_index = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("infection_indices", 0);

  /* "pyross/inference.pyx":4428
 * 
 *     def infection_indices(self):
 *         cdef Py_ssize_t a = 100             # <<<<<<<<<<<<<<
 *         indices = set()
 *         linear_terms_indices = list(range(self.linear_terms.shape[0]))
 */
  __pyx_v_a = 0x64;

  /* "pyross/inference.pyx":4429
 *     def infection_indices(self):
 *         cdef Py_ssize_t a = 100
 *         indices = set()             # <<<<<<<<<<<<<<
 *         linear_terms_indices = list(range(self.linear_terms.shape[0]))
 * 
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_indices = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4430
 *         cdef Py_ssize_t a = 100
 *         indices = set()
 *         linear_terms_indices = list(range(self.linear_terms.shape[0]))             # <<<<<<<<<<<<<<
 * 
 *         # Find all the infection terms
 */
  __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_self->linear_terms->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_linear_terms_indices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4433
 * 
 *         # Find all the infection terms
 *         for term in self.infection_terms:             # <<<<<<<<<<<<<<
 *             infective_index = term[1]
 *             indices.add(infective_index)
 */
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->infection_terms))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->infection_terms))) {
    __pyx_t_1 = ((PyObject *)__pyx_v_self->infection_terms); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->infection_terms)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4433, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4433, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4433, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4433, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4433, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 4433, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_term, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4434
 *         # Find all the infection terms
 *         for term in self.infection_terms:
 *             infective_index = term[1]             # <<<<<<<<<<<<<<
 *             indices.add(infective_index)
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_term, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_infective_index, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4435
 *         for term in self.infection_terms:
 *             infective_index = term[1]
 *             indices.add(infective_index)             # <<<<<<<<<<<<<<
 * 
 *         # Find all the terms that turn into infection terms
 */
    __pyx_t_5 = PySet_Add(__pyx_v_indices, __pyx_v_infective_index); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 4435, __pyx_L1_error)

    /* "pyross/inference.pyx":4433
 * 
 *         # Find all the infection terms
 *         for term in self.infection_terms:             # <<<<<<<<<<<<<<
 *             infective_index = term[1]
 *             indices.add(infective_index)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4438
 * 
 *         # Find all the terms that turn into infection terms
 *         a = 100             # <<<<<<<<<<<<<<
 *         while a > 0:
 *             a = 0
 */
  __pyx_v_a = 0x64;

  /* "pyross/inference.pyx":4439
 *         # Find all the terms that turn into infection terms
 *         a = 100
 *         while a > 0:             # <<<<<<<<<<<<<<
 *             a = 0
 *             temp = linear_terms_indices.copy()
 */
  while (1) {
    __pyx_t_6 = ((__pyx_v_a > 0) != 0);
    if (!__pyx_t_6) break;

    /* "pyross/inference.pyx":4440
 *         a = 100
 *         while a > 0:
 *             a = 0             # <<<<<<<<<<<<<<
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:
 */
    __pyx_v_a = 0;

    /* "pyross/inference.pyx":4441
 *         while a > 0:
 *             a = 0
 *             temp = linear_terms_indices.copy()             # <<<<<<<<<<<<<<
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_linear_terms_indices, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_temp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4442
 *             a = 0
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:             # <<<<<<<<<<<<<<
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:
 */
    if (likely(PyList_CheckExact(__pyx_v_linear_terms_indices)) || PyTuple_CheckExact(__pyx_v_linear_terms_indices)) {
      __pyx_t_1 = __pyx_v_linear_terms_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_linear_terms_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4442, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4442, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4442, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4442, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4442, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_4(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 4442, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pyross/inference.pyx":4443
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]             # <<<<<<<<<<<<<<
 *                 if product_index in indices:
 *                     a += 1
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_2);
      __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->linear_terms), __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_product_index, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyross/inference.pyx":4444
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:             # <<<<<<<<<<<<<<
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])
 */
      __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_v_product_index, __pyx_v_indices, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 4444, __pyx_L1_error)
      __pyx_t_8 = (__pyx_t_6 != 0);
      if (__pyx_t_8) {

        /* "pyross/inference.pyx":4445
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:
 *                     a += 1             # <<<<<<<<<<<<<<
 *                     indices.add(self.linear_terms[i, 1])
 *                     temp.remove(i)
 */
        __pyx_v_a = (__pyx_v_a + 1);

        /* "pyross/inference.pyx":4446
 *                 if product_index in indices:
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])             # <<<<<<<<<<<<<<
 *                     temp.remove(i)
 *             linear_terms_indices = temp
 */
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4446, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_1);
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->linear_terms), __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4446, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_5 = PySet_Add(__pyx_v_indices, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 4446, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pyross/inference.pyx":4447
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])
 *                     temp.remove(i)             # <<<<<<<<<<<<<<
 *             linear_terms_indices = temp
 *         return list(indices)
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_temp, __pyx_n_s_remove); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_v_i) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_i);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pyross/inference.pyx":4444
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:             # <<<<<<<<<<<<<<
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])
 */
      }

      /* "pyross/inference.pyx":4442
 *             a = 0
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:             # <<<<<<<<<<<<<<
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4448
 *                     indices.add(self.linear_terms[i, 1])
 *                     temp.remove(i)
 *             linear_terms_indices = temp             # <<<<<<<<<<<<<<
 *         return list(indices)
 * 
 */
    __Pyx_INCREF(__pyx_v_temp);
    __Pyx_DECREF_SET(__pyx_v_linear_terms_indices, __pyx_v_temp);
  }

  /* "pyross/inference.pyx":4449
 *                     temp.remove(i)
 *             linear_terms_indices = temp
 *         return list(indices)             # <<<<<<<<<<<<<<
 * 
 *     def set_params(self, parameters):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(__pyx_v_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4427
 *                 self.finres_pop[i] = np.zeros(self.M, dtype=DTYPE)
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t a = 100
 *         indices = set()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.Spp.infection_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XDECREF(__pyx_v_linear_terms_indices);
  __Pyx_XDECREF(__pyx_v_term);
  __Pyx_XDECREF(__pyx_v_infective_index);
  __Pyx_XDECREF(__pyx_v_temp);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_product_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4451
 *         return list(indices)
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_params (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_4set_params(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_4set_params(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_parameters) {
  Py_ssize_t __pyx_v_nParams;
  PyObject *__pyx_v_model_parameters = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_param = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("set_params", 0);

  /* "pyross/inference.pyx":4452
 * 
 *     def set_params(self, parameters):
 *         if self.det_model is not None:             # <<<<<<<<<<<<<<
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4453
 *     def set_params(self, parameters):
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)             # <<<<<<<<<<<<<<
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4452
 * 
 *     def set_params(self, parameters):
 *         if self.det_model is not None:             # <<<<<<<<<<<<<<
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)
 */
  }

  /* "pyross/inference.pyx":4454
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)             # <<<<<<<<<<<<<<
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.param_keys;
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 4454, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4454, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_nParams = __pyx_t_6;

  /* "pyross/inference.pyx":4455
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             model_parameters = self.parameter_mapping(parameters)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_parameters, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 4455, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->param_dict);
  __Pyx_DECREF(__pyx_v_self->param_dict);
  __pyx_v_self->param_dict = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":4456
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)
 */
  __pyx_t_2 = (__pyx_v_self->parameter_mapping != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4457
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:
 *             model_parameters = self.parameter_mapping(parameters)             # <<<<<<<<<<<<<<
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 */
    __Pyx_INCREF(__pyx_v_self->parameter_mapping);
    __pyx_t_4 = __pyx_v_self->parameter_mapping; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_model_parameters = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4458
 *         if self.parameter_mapping is not None:
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)             # <<<<<<<<<<<<<<
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 */
    __pyx_t_3 = __pyx_v_self->model_param_keys;
    __Pyx_INCREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 4458, __pyx_L1_error)
    }
    __pyx_t_6 = PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4458, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_nParams = __pyx_t_6;

    /* "pyross/inference.pyx":4459
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->model_parameters);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters));
    __pyx_v_self->model_parameters = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4460
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)             # <<<<<<<<<<<<<<
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intp); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4460, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_GOTREF(__pyx_v_self->model_parameters_length);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters_length));
    __pyx_v_self->model_parameters_length = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyross/inference.pyx":4461
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pyross/inference.pyx":4462
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_8 = __pyx_int_0;
        __pyx_t_3 = __pyx_v_self->model_param_keys; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
        for (;;) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 4462, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4462, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
          __pyx_t_5 = 0;
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
          __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4462, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_8);
          __pyx_t_8 = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4463
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]             # <<<<<<<<<<<<<<
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                     self.model_parameters_length[i] = np.size(param)
 */
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_model_parameters, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4463, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4464
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)             # <<<<<<<<<<<<<<
 *                     self.model_parameters_length[i] = np.size(param)
 *             except KeyError:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyross); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4464, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4464, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4464, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4464, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = NULL;
          __pyx_t_13 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_13 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_param, __pyx_t_4, __pyx_v_key};
            __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4464, __pyx_L5_error)
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_param, __pyx_t_4, __pyx_v_key};
            __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4464, __pyx_L5_error)
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else
          #endif
          {
            __pyx_t_14 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4464, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_14);
            if (__pyx_t_12) {
              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
            }
            __Pyx_INCREF(__pyx_v_param);
            __Pyx_GIVEREF(__pyx_v_param);
            PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_v_param);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_4);
            __Pyx_INCREF(__pyx_v_key);
            __Pyx_GIVEREF(__pyx_v_key);
            PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_13, __pyx_v_key);
            __pyx_t_4 = 0;
            __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4464, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_v_i, __pyx_t_5) < 0)) __PYX_ERR(0, 4464, __pyx_L5_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4465
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                     self.model_parameters_length[i] = np.size(param)             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4465, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_size); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4465, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_7, __pyx_v_param) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_param);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4465, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters_length), __pyx_v_i, __pyx_t_5) < 0)) __PYX_ERR(0, 4465, __pyx_L5_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4462
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "pyross/inference.pyx":4461
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L10_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pyross/inference.pyx":4466
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                     self.model_parameters_length[i] = np.size(param)
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:
 */
      __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_13) {
        __Pyx_AddTraceback("pyross.inference.Spp.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 4466, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);

        /* "pyross/inference.pyx":4467
 *                     self.model_parameters_length[i] = np.size(param)
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))             # <<<<<<<<<<<<<<
 *         elif self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(0)
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_The_parameters_returned_by_param, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4467, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_14 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_self->model_param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->model_param_keys);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4467, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4467, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(0, 4467, __pyx_L7_except_error)
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;

      /* "pyross/inference.pyx":4461
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L10_try_end:;
    }

    /* "pyross/inference.pyx":4456
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":4468
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(0)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->time_dep_param_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4469
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(0)             # <<<<<<<<<<<<<<
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_time_dep_model_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":4468
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(0)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":4471
 *             self.set_time_dep_model_parameters(0)
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->model_parameters);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters));
    __pyx_v_self->model_parameters = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":4472
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)             # <<<<<<<<<<<<<<
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_intp); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_14) < 0) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4472, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_14);
    __Pyx_GOTREF(__pyx_v_self->model_parameters_length);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters_length));
    __pyx_v_self->model_parameters_length = ((PyArrayObject *)__pyx_t_14);
    __pyx_t_14 = 0;

    /* "pyross/inference.pyx":4473
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pyross/inference.pyx":4474
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):             # <<<<<<<<<<<<<<
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_14 = __pyx_int_0;
        __pyx_t_5 = __pyx_v_self->__pyx_base.param_keys; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
        for (;;) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 4474, __pyx_L15_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4474, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_14);
          __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_14, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4474, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_14);
          __pyx_t_14 = __pyx_t_8;
          __pyx_t_8 = 0;

          /* "pyross/inference.pyx":4475
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]             # <<<<<<<<<<<<<<
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                     self.model_parameters_length[i] = np.size(param)
 */
          __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_parameters, __pyx_v_key); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4475, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "pyross/inference.pyx":4476
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)             # <<<<<<<<<<<<<<
 *                     self.model_parameters_length[i] = np.size(param)
 *             except KeyError:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyross); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4476, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4476, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4476, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4476, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = NULL;
          __pyx_t_13 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_13 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_param, __pyx_t_3, __pyx_v_key};
            __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4476, __pyx_L15_error)
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_param, __pyx_t_3, __pyx_v_key};
            __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4476, __pyx_L15_error)
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_12 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4476, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_4) {
              __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __pyx_t_4 = NULL;
            }
            __Pyx_INCREF(__pyx_v_param);
            __Pyx_GIVEREF(__pyx_v_param);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_13, __pyx_v_param);
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_13, __pyx_t_3);
            __Pyx_INCREF(__pyx_v_key);
            __Pyx_GIVEREF(__pyx_v_key);
            PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_13, __pyx_v_key);
            __pyx_t_3 = 0;
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4476, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_v_i, __pyx_t_8) < 0)) __PYX_ERR(0, 4476, __pyx_L15_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "pyross/inference.pyx":4477
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                     self.model_parameters_length[i] = np.size(param)             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4477, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_size); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4477, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_7, __pyx_v_param) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_param);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4477, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters_length), __pyx_v_i, __pyx_t_8) < 0)) __PYX_ERR(0, 4477, __pyx_L15_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "pyross/inference.pyx":4474
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):             # <<<<<<<<<<<<<<
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

        /* "pyross/inference.pyx":4473
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 */
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L20_try_end;
      __pyx_L15_error:;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pyross/inference.pyx":4478
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                     self.model_parameters_length[i] = np.size(param)
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))
 * 
 */
      __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_13) {
        __Pyx_AddTraceback("pyross.inference.Spp.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 4478, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_8);

        /* "pyross/inference.pyx":4479
 *                     self.model_parameters_length[i] = np.size(param)
 *             except KeyError:
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))             # <<<<<<<<<<<<<<
 * 
 *     def set_time_dep_model_parameters(self, tt):
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_The_parameters_passed_do_not_con, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4479, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_v_self->__pyx_base.param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->__pyx_base.param_keys);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4479, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4479, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(0, 4479, __pyx_L17_except_error)
      }
      goto __pyx_L17_except_error;
      __pyx_L17_except_error:;

      /* "pyross/inference.pyx":4473
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 */
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L20_try_end:;
    }
  }
  __pyx_L4:;

  /* "pyross/inference.pyx":4451
 *         return list(indices)
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyross.inference.Spp.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_model_parameters);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_param);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4481
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))
 * 
 *     def set_time_dep_model_parameters(self, tt):             # <<<<<<<<<<<<<<
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_7set_time_dep_model_parameters(PyObject *__pyx_v_self, PyObject *__pyx_v_tt); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_7set_time_dep_model_parameters(PyObject *__pyx_v_self, PyObject *__pyx_v_tt) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_time_dep_model_parameters (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_6set_time_dep_model_parameters(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self), ((PyObject *)__pyx_v_tt));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_6set_time_dep_model_parameters(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_tt) {
  PyObject *__pyx_v_model_parameters = NULL;
  Py_ssize_t __pyx_v_nParams;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_param = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("set_time_dep_model_parameters", 0);

  /* "pyross/inference.pyx":4482
 * 
 *     def set_time_dep_model_parameters(self, tt):
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)             # <<<<<<<<<<<<<<
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 */
  __Pyx_INCREF(__pyx_v_self->time_dep_param_mapping);
  __pyx_t_2 = __pyx_v_self->time_dep_param_mapping; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->param_dict, __pyx_v_tt};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4482, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->param_dict, __pyx_v_tt};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4482, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self->param_dict);
    __Pyx_GIVEREF(__pyx_v_self->param_dict);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self->param_dict);
    __Pyx_INCREF(__pyx_v_tt);
    __Pyx_GIVEREF(__pyx_v_tt);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_tt);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_model_parameters = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4483
 *     def set_time_dep_model_parameters(self, tt):
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)             # <<<<<<<<<<<<<<
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 */
  __pyx_t_1 = __pyx_v_self->model_param_keys;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 4483, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nParams = __pyx_t_6;

  /* "pyross/inference.pyx":4484
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4484, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->model_parameters);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters));
  __pyx_v_self->model_parameters = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4485
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         self.model_parameters_length = np.empty(nParams, dtype=np.intp)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_intp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(__pyx_v_self->model_parameters_length);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters_length));
  __pyx_v_self->model_parameters_length = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pyross/inference.pyx":4487
 *         self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    /*try:*/ {

      /* "pyross/inference.pyx":4488
 * 
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_t_7 = __pyx_int_0;
      __pyx_t_1 = __pyx_v_self->model_param_keys; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
      for (;;) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 4488, __pyx_L3_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4488, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_7);
        __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4488, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7);
        __pyx_t_7 = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4489
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]             # <<<<<<<<<<<<<<
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                 self.model_parameters_length[i] = np.size(param)
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_model_parameters, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4489, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4490
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)             # <<<<<<<<<<<<<<
 *                 self.model_parameters_length[i] = np.size(param)
 *         except KeyError:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4490, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4490, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4490, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4490, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_11 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_4 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_param, __pyx_t_2, __pyx_v_key};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4490, __pyx_L3_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_param, __pyx_t_2, __pyx_v_key};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4490, __pyx_L3_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4490, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
          }
          __Pyx_INCREF(__pyx_v_param);
          __Pyx_GIVEREF(__pyx_v_param);
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_4, __pyx_v_param);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_4, __pyx_t_2);
          __Pyx_INCREF(__pyx_v_key);
          __Pyx_GIVEREF(__pyx_v_key);
          PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_4, __pyx_v_key);
          __pyx_t_2 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4490, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_v_i, __pyx_t_5) < 0)) __PYX_ERR(0, 4490, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4491
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                 self.model_parameters_length[i] = np.size(param)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             raise Exception('The parameters passed do not contain certain keys.\
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4491, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_size); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4491, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_3, __pyx_v_param) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_param);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4491, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters_length), __pyx_v_i, __pyx_t_5) < 0)) __PYX_ERR(0, 4491, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4488
 * 
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyross/inference.pyx":4487
 *         self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 */
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4492
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *                 self.model_parameters_length[i] = np.size(param)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise Exception('The parameters passed do not contain certain keys.\
 *                              The keys are {}'.format(self.param_keys))
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("pyross.inference.Spp.set_time_dep_model_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 4492, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);

      /* "pyross/inference.pyx":4494
 *         except KeyError:
 *             raise Exception('The parameters passed do not contain certain keys.\
 *                              The keys are {}'.format(self.param_keys))             # <<<<<<<<<<<<<<
 * 
 *     def set_det_model(self, parameters):
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_The_parameters_passed_do_not_con_2, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4494, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_12 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_self->__pyx_base.param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->__pyx_base.param_keys);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4494, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pyross/inference.pyx":4493
 *                 self.model_parameters_length[i] = np.size(param)
 *         except KeyError:
 *             raise Exception('The parameters passed do not contain certain keys.\             # <<<<<<<<<<<<<<
 *                              The keys are {}'.format(self.param_keys))
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4493, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 4493, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyross/inference.pyx":4487
 *         self.model_parameters_length = np.empty(nParams, dtype=np.intp)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 */
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "pyross/inference.pyx":4481
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))
 * 
 *     def set_time_dep_model_parameters(self, tt):             # <<<<<<<<<<<<<<
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.Spp.set_time_dep_model_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_model_parameters);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_param);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4496
 *                              The keys are {}'.format(self.param_keys))
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_9set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_9set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_8set_det_model(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_8set_det_model(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("set_det_model", 0);

  /* "pyross/inference.pyx":4497
 * 
 *     def set_det_model(self, parameters):
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->parameter_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4498
 *     def set_det_model(self, parameters):
 *         if self.parameter_mapping is not None:
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))             # <<<<<<<<<<<<<<
 *         else:
 *             self.det_model.update_model_parameters(parameters)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->det_model), __pyx_n_s_update_model_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_self->parameter_mapping);
    __pyx_t_6 = __pyx_v_self->parameter_mapping; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4497
 * 
 *     def set_det_model(self, parameters):
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":4500
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 *         else:
 *             self.det_model.update_model_parameters(parameters)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->det_model), __pyx_n_s_update_model_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":4496
 *                              The keys are {}'.format(self.param_keys))
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.Spp.set_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4503
 * 
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         param_dict = self.param_dict.copy()
 *         return param_dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_11make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_11make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_10make_params_dict(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_10make_params_dict(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_v_param_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":4504
 * 
 *     def make_params_dict(self):
 *         param_dict = self.param_dict.copy()             # <<<<<<<<<<<<<<
 *         return param_dict
 * 
 */
  if (unlikely(__pyx_v_self->param_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
    __PYX_ERR(0, 4504, __pyx_L1_error)
  }
  __pyx_t_1 = PyDict_Copy(__pyx_v_self->param_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_param_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4505
 *     def make_params_dict(self):
 *         param_dict = self.param_dict.copy()
 *         return param_dict             # <<<<<<<<<<<<<<
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_param_dict);
  __pyx_r = __pyx_v_param_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4503
 * 
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         param_dict = self.param_dict.copy()
 *         return param_dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.Spp.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4507
 *         return param_dict
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray r
 */

static PyArrayObject *__pyx_f_6pyross_9inference_3Spp__get_r_from_x(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyArrayObject *__pyx_v_x) {
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_v_xrs = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("_get_r_from_x", 0);

  /* "pyross/inference.pyx":4510
 *         cdef:
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)             # <<<<<<<<<<<<<<
 *         if 'R' in self.class_index_dict.keys():
 *             r = xrs[self.class_index_dict['R'],:]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_self->__pyx_base.dim / __pyx_v_self->__pyx_base.M)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4510, __pyx_L1_error)
  __pyx_v_xrs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4511
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         if 'R' in self.class_index_dict.keys():             # <<<<<<<<<<<<<<
 *             r = xrs[self.class_index_dict['R'],:]
 *         if self.constant_terms.size > 0:
 */
  if (unlikely(__pyx_v_self->__pyx_base.class_index_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 4511, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_self->__pyx_base.class_index_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_R, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4511, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":4512
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         if 'R' in self.class_index_dict.keys():
 *             r = xrs[self.class_index_dict['R'],:]             # <<<<<<<<<<<<<<
 *         if self.constant_terms.size > 0:
 *             r = xrs[-1,:] - np.sum(xrs[:-1,:], axis=0)
 */
    if (unlikely(__pyx_v_self->__pyx_base.class_index_dict == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 4512, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base.class_index_dict, __pyx_n_u_R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_INCREF(__pyx_slice_);
    __Pyx_GIVEREF(__pyx_slice_);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice_);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4512, __pyx_L1_error)
    __pyx_v_r = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4511
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         if 'R' in self.class_index_dict.keys():             # <<<<<<<<<<<<<<
 *             r = xrs[self.class_index_dict['R'],:]
 *         if self.constant_terms.size > 0:
 */
  }

  /* "pyross/inference.pyx":4513
 *         if 'R' in self.class_index_dict.keys():
 *             r = xrs[self.class_index_dict['R'],:]
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             r = xrs[-1,:] - np.sum(xrs[:-1,:], axis=0)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 4513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":4514
 *             r = xrs[self.class_index_dict['R'],:]
 *         if self.constant_terms.size > 0:
 *             r = xrs[-1,:] - np.sum(xrs[:-1,:], axis=0)             # <<<<<<<<<<<<<<
 *         else:
 *             r = self.fi - np.sum(xrs, axis=0)
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_tuple__48); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_tuple__50); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 4514, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4514, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_r, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4513
 *         if 'R' in self.class_index_dict.keys():
 *             r = xrs[self.class_index_dict['R'],:]
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             r = xrs[-1,:] - np.sum(xrs[:-1,:], axis=0)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":4516
 *             r = xrs[-1,:] - np.sum(xrs[:-1,:], axis=0)
 *         else:
 *             r = self.fi - np.sum(xrs, axis=0)             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_xrs));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_xrs));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_xrs));
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 4516, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4516, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_r, ((PyArrayObject *)__pyx_t_2));
    __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "pyross/inference.pyx":4517
 *         else:
 *             r = self.fi - np.sum(xrs, axis=0)
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_r));
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4507
 *         return param_dict
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray r
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.Spp._get_r_from_x", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_xrs);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4519
 *         return r
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix *__pyx_optional_args) {

  /* "pyross/inference.pyx":4520
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                             b_matrix=True, jacobian=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, M=self.M
 */
  PyObject *__pyx_v_b_matrix = ((PyObject *)Py_True);
  PyObject *__pyx_v_jacobian = ((PyObject *)Py_False);
  Py_ssize_t __pyx_v_nClass;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_num_of_infection_terms;
  __Pyx_memviewslice __pyx_v_l = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_b_matrix = __pyx_optional_args->b_matrix;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_jacobian = __pyx_optional_args->jacobian;
      }
    }
  }

  /* "pyross/inference.pyx":4522
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, M=self.M             # <<<<<<<<<<<<<<
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.nClass;
  __pyx_v_nClass = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":4523
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, M=self.M
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]             # <<<<<<<<<<<<<<
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 *             double [:] fi=self.fi
 */
  __pyx_v_num_of_infection_terms = (__pyx_v_self->infection_terms->dimensions[0]);

  /* "pyross/inference.pyx":4524
 *             Py_ssize_t nClass=self.nClass, M=self.M
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             double [:] fi=self.fi
 *         self.CM = self.contactMatrix(t)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_num_of_infection_terms); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 4524, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_l = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":4525
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:
 */
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 4525, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "pyross/inference.pyx":4526
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 *             double [:] fi=self.fi
 *         self.CM = self.contactMatrix(t)             # <<<<<<<<<<<<<<
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __pyx_t_4 = __pyx_v_self->__pyx_base.contactMatrix; __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4526, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __pyx_v_self->__pyx_base.CM = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4527
 *             double [:] fi=self.fi
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(t)
 *         if self.constant_terms.size > 0:
 */
  __pyx_t_8 = (__pyx_v_self->time_dep_param_mapping != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":4528
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)             # <<<<<<<<<<<<<<
 *         if self.constant_terms.size > 0:
 *             fi = x[(nClass-1)*M:]
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_time_dep_model_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4527
 *             double [:] fi=self.fi
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(t)
 *         if self.constant_terms.size > 0:
 */
  }

  /* "pyross/inference.pyx":4529
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             fi = x[(nClass-1)*M:]
 *         self.fill_lambdas(x, l)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 4529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":4530
 *             self.set_time_dep_model_parameters(t)
 *         if self.constant_terms.size > 0:
 *             fi = x[(nClass-1)*M:]             # <<<<<<<<<<<<<<
 *         self.fill_lambdas(x, l)
 *         self.fill_finres_pop(x)
 */
    __pyx_t_7.data = __pyx_v_x.data;
    __pyx_t_7.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    __pyx_t_10 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_7,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_10,
    ((__pyx_v_nClass - 1) * __pyx_v_M),
    0,
    0,
    1,
    0,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4530, __pyx_L1_error)
}

__PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
    __pyx_v_fi = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":4529
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             fi = x[(nClass-1)*M:]
 *         self.fill_lambdas(x, l)
 */
  }

  /* "pyross/inference.pyx":4531
 *         if self.constant_terms.size > 0:
 *             fi = x[(nClass-1)*M:]
 *         self.fill_lambdas(x, l)             # <<<<<<<<<<<<<<
 *         self.fill_finres_pop(x)
 *         if b_matrix:
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pyross_9inference_Spp *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_lambdas(__pyx_v_self, __pyx_v_x, __pyx_v_l); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4532
 *             fi = x[(nClass-1)*M:]
 *         self.fill_lambdas(x, l)
 *         self.fill_finres_pop(x)             # <<<<<<<<<<<<<<
 *         if b_matrix:
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pyross_9inference_Spp *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_finres_pop(__pyx_v_self, __pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4533
 *         self.fill_lambdas(x, l)
 *         self.fill_finres_pop(x)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l)
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_b_matrix); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 4533, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":4534
 *         self.fill_finres_pop(x)
 *         if b_matrix:
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             self.noise_correlation(x, l)
 *         if jacobian:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_11);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_11 = 0;
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4534, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.B);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B));
    __pyx_v_self->__pyx_base.B = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4535
 *         if b_matrix:
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l)             # <<<<<<<<<<<<<<
 *         if jacobian:
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_6pyross_9inference_Spp *)__pyx_v_self->__pyx_base.__pyx_vtab)->noise_correlation(__pyx_v_self, __pyx_v_x, __pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4533
 *         self.fill_lambdas(x, l)
 *         self.fill_finres_pop(x)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l)
 */
  }

  /* "pyross/inference.pyx":4536
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.jacobian(x, l)
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_jacobian); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 4536, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":4537
 *             self.noise_correlation(x, l)
 *         if jacobian:
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             self.jacobian(x, l)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_11 = 0;
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4537, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.J);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J));
    __pyx_v_self->__pyx_base.J = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4538
 *         if jacobian:
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.jacobian(x, l)             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_Spp *)__pyx_v_self->__pyx_base.__pyx_vtab)->jacobian(__pyx_v_self, __pyx_v_x, __pyx_v_l); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4536
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.jacobian(x, l)
 */
  }

  /* "pyross/inference.pyx":4519
 *         return r
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                             b_matrix=True, jacobian=False):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.Spp.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_l, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4540
 *             self.jacobian(x, l)
 * 
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

static PyObject *__pyx_f_6pyross_9inference_3Spp_fill_lambdas(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l) {
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_infection_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_infective_index;
  Py_ssize_t __pyx_v_index;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_num_of_infection_terms;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __Pyx_RefNannySetupContext("fill_lambdas", 0);

  /* "pyross/inference.pyx":4542
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):
 *         cdef:
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             int [:, :] infection_terms=self.infection_terms
 *             double infection_rate
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 4542, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":4543
 *         cdef:
 *             double [:, :] CM=self.CM
 *             int [:, :] infection_terms=self.infection_terms             # <<<<<<<<<<<<<<
 *             double infection_rate
 *             double [:] fi=self.fi
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->infection_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 4543, __pyx_L1_error)
  __pyx_v_infection_terms = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":4545
 *             int [:, :] infection_terms=self.infection_terms
 *             double infection_rate
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]
 *         for i in range(num_of_infection_terms):
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4545, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4546
 *             double infection_rate
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]             # <<<<<<<<<<<<<<
 *         for i in range(num_of_infection_terms):
 *             infective_index = infection_terms[i, 1]
 */
  __pyx_t_4 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_4;
  __pyx_v_num_of_infection_terms = (__pyx_v_infection_terms.shape[0]);

  /* "pyross/inference.pyx":4547
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]
 *         for i in range(num_of_infection_terms):             # <<<<<<<<<<<<<<
 *             infective_index = infection_terms[i, 1]
 *             for m in range(M):
 */
  __pyx_t_4 = __pyx_v_num_of_infection_terms;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pyross/inference.pyx":4548
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]
 *         for i in range(num_of_infection_terms):
 *             infective_index = infection_terms[i, 1]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 for n in range(M):
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = 1;
    __pyx_v_infective_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_7 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_8 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4549
 *         for i in range(num_of_infection_terms):
 *             infective_index = infection_terms[i, 1]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 for n in range(M):
 *                     index = n + M*infective_index
 */
    __pyx_t_9 = __pyx_v_M;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_m = __pyx_t_11;

      /* "pyross/inference.pyx":4550
 *             infective_index = infection_terms[i, 1]
 *             for m in range(M):
 *                 for n in range(M):             # <<<<<<<<<<<<<<
 *                     index = n + M*infective_index
 *                     if fi[n]>0:
 */
      __pyx_t_12 = __pyx_v_M;
      __pyx_t_13 = __pyx_t_12;
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
        __pyx_v_n = __pyx_t_14;

        /* "pyross/inference.pyx":4551
 *             for m in range(M):
 *                 for n in range(M):
 *                     index = n + M*infective_index             # <<<<<<<<<<<<<<
 *                     if fi[n]>0:
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 */
        __pyx_v_index = (__pyx_v_n + (__pyx_v_M * __pyx_v_infective_index));

        /* "pyross/inference.pyx":4552
 *                 for n in range(M):
 *                     index = n + M*infective_index
 *                     if fi[n]>0:             # <<<<<<<<<<<<<<
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 */
        __pyx_t_15 = __pyx_v_n;
        __pyx_t_16 = (((*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_15 * __pyx_v_fi.strides[0]) ))) > 0.0) != 0);
        if (__pyx_t_16) {

          /* "pyross/inference.pyx":4553
 *                     index = n + M*infective_index
 *                     if fi[n]>0:
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_finres_pop(self, double [:] x):
 */
          __pyx_t_17 = __pyx_v_m;
          __pyx_t_18 = __pyx_v_n;
          __pyx_t_19 = __pyx_v_index;
          __pyx_t_20 = __pyx_v_n;
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_22 = __pyx_v_m;
          *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_21 * __pyx_v_l.strides[0]) ) + __pyx_t_22 * __pyx_v_l.strides[1]) )) += (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_17 * __pyx_v_CM.strides[0]) ) + __pyx_t_18 * __pyx_v_CM.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_19 * __pyx_v_x.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_20 * __pyx_v_fi.strides[0]) ))));

          /* "pyross/inference.pyx":4552
 *                 for n in range(M):
 *                     index = n + M*infective_index
 *                     if fi[n]>0:             # <<<<<<<<<<<<<<
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 */
        }
      }
    }
  }

  /* "pyross/inference.pyx":4540
 *             self.jacobian(x, l)
 * 
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_AddTraceback("pyross.inference.Spp.fill_lambdas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_infection_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4555
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 *     cdef fill_finres_pop(self, double [:] x):             # <<<<<<<<<<<<<<
 *         # Calculate populations for finite resource transitions
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_3Spp_fill_finres_pop(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x) {
  Py_ssize_t __pyx_v_class_index;
  Py_ssize_t __pyx_v_priority_index;
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *(*__pyx_t_13)(PyObject *);
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  PyArrayObject *__pyx_t_17 = NULL;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  __Pyx_RefNannySetupContext("fill_finres_pop", 0);

  /* "pyross/inference.pyx":4559
 *         cdef:
 *             Py_ssize_t class_index, priority_index, m, i
 *         for i in range(len(self.resource_list)):             # <<<<<<<<<<<<<<
 *             if np.size(self.finres_pop[i]) == 1:
 *                 self.finres_pop[i] = 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->resource_list);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "pyross/inference.pyx":4560
 *             Py_ssize_t class_index, priority_index, m, i
 *         for i in range(len(self.resource_list)):
 *             if np.size(self.finres_pop[i]) == 1:             # <<<<<<<<<<<<<<
 *                 self.finres_pop[i] = 0
 *             else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4560, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_8) {

      /* "pyross/inference.pyx":4561
 *         for i in range(len(self.resource_list)):
 *             if np.size(self.finres_pop[i]) == 1:
 *                 self.finres_pop[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 self.finres_pop[i] = np.zeros(np.size(self.finres_pop[i]))
 */
      if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, __pyx_int_0, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 4561, __pyx_L1_error)

      /* "pyross/inference.pyx":4560
 *             Py_ssize_t class_index, priority_index, m, i
 *         for i in range(len(self.resource_list)):
 *             if np.size(self.finres_pop[i]) == 1:             # <<<<<<<<<<<<<<
 *                 self.finres_pop[i] = 0
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pyross/inference.pyx":4563
 *                 self.finres_pop[i] = 0
 *             else:
 *                 self.finres_pop[i] = np.zeros(np.size(self.finres_pop[i]))             # <<<<<<<<<<<<<<
 *             for (class_index, priority_index) in self.resource_list[i][1:]:
 *                 for m in range(self.M):
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 4563, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L5:;

    /* "pyross/inference.pyx":4564
 *             else:
 *                 self.finres_pop[i] = np.zeros(np.size(self.finres_pop[i]))
 *             for (class_index, priority_index) in self.resource_list[i][1:]:             # <<<<<<<<<<<<<<
 *                 for m in range(self.M):
 *                     if np.size(self.finres_pop[i]) == 1:
 */
    __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->resource_list), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_6, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4564, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 4564, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4564, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 4564, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4564, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_12(__pyx_t_6);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 4564, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 4564, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4564, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4564, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4564, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_13 = Py_TYPE(__pyx_t_7)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_9 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_7), 2) < 0) __PYX_ERR(0, 4564, __pyx_L1_error)
        __pyx_t_13 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_13 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 4564, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_class_index = __pyx_t_14;
      __pyx_v_priority_index = __pyx_t_15;

      /* "pyross/inference.pyx":4565
 *                 self.finres_pop[i] = np.zeros(np.size(self.finres_pop[i]))
 *             for (class_index, priority_index) in self.resource_list[i][1:]:
 *                 for m in range(self.M):             # <<<<<<<<<<<<<<
 *                     if np.size(self.finres_pop[i]) == 1:
 *                         self.finres_pop[i] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 */
      __pyx_t_15 = __pyx_v_self->__pyx_base.M;
      __pyx_t_14 = __pyx_t_15;
      for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_14; __pyx_t_16+=1) {
        __pyx_v_m = __pyx_t_16;

        /* "pyross/inference.pyx":4566
 *             for (class_index, priority_index) in self.resource_list[i][1:]:
 *                 for m in range(self.M):
 *                     if np.size(self.finres_pop[i]) == 1:             # <<<<<<<<<<<<<<
 *                         self.finres_pop[i] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 *                     else:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 4566, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_8) {

          /* "pyross/inference.pyx":4567
 *                 for m in range(self.M):
 *                     if np.size(self.finres_pop[i]) == 1:
 *                         self.finres_pop[i] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]             # <<<<<<<<<<<<<<
 *                     else:
 *                         self.finres_pop[i][m] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 */
          __Pyx_INCREF(((PyObject *)__pyx_v_self->finres_pop));
          __pyx_t_17 = __pyx_v_self->finres_pop;
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_t_17), __pyx_t_18, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_19 = (__pyx_v_m + (__pyx_v_self->__pyx_base.M * __pyx_v_class_index));
          __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_19 * __pyx_v_x.strides[0]) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_priority_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7);
          __pyx_t_9 = 0;
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_t_17), __pyx_t_18, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 4567, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;

          /* "pyross/inference.pyx":4566
 *             for (class_index, priority_index) in self.resource_list[i][1:]:
 *                 for m in range(self.M):
 *                     if np.size(self.finres_pop[i]) == 1:             # <<<<<<<<<<<<<<
 *                         self.finres_pop[i] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 *                     else:
 */
          goto __pyx_L12;
        }

        /* "pyross/inference.pyx":4569
 *                         self.finres_pop[i] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 *                     else:
 *                         self.finres_pop[i][m] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]             # <<<<<<<<<<<<<<
 * 
 *     cdef jacobian(self, double [:] x, double [:, :] l):
 */
        /*else*/ {
          __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->finres_pop), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_18 = __pyx_v_m;
          __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_7, __pyx_t_18, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_20 = (__pyx_v_m + (__pyx_v_self->__pyx_base.M * __pyx_v_class_index));
          __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_20 * __pyx_v_x.strides[0]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_priority_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_9);
          __pyx_t_5 = 0;
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_t_21); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __pyx_t_21 = PyNumber_Multiply(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_t_10, __pyx_t_21); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (unlikely(__Pyx_SetItemInt(__pyx_t_7, __pyx_t_18, __pyx_t_9, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 4569, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_L12:;
      }

      /* "pyross/inference.pyx":4564
 *             else:
 *                 self.finres_pop[i] = np.zeros(np.size(self.finres_pop[i]))
 *             for (class_index, priority_index) in self.resource_list[i][1:]:             # <<<<<<<<<<<<<<
 *                 for m in range(self.M):
 *                     if np.size(self.finres_pop[i]) == 1:
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }

  /* "pyross/inference.pyx":4555
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 *     cdef fill_finres_pop(self, double [:] x):             # <<<<<<<<<<<<<<
 *         # Calculate populations for finite resource transitions
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(((PyObject *)__pyx_t_17));
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_AddTraceback("pyross.inference.Spp.fill_finres_pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4571
 *                         self.finres_pop[i][m] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 * 
 *     cdef jacobian(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 */

static PyObject *__pyx_f_6pyross_9inference_3Spp_jacobian(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_dim;
  Py_ssize_t __pyx_v_rate_index;
  Py_ssize_t __pyx_v_infective_index;
  Py_ssize_t __pyx_v_product_index;
  Py_ssize_t __pyx_v_reagent_index;
  Py_ssize_t __pyx_v_S_index;
  Py_ssize_t __pyx_v_resource_index;
  Py_ssize_t __pyx_v_priority_index;
  Py_ssize_t __pyx_v_probability_index;
  Py_ssize_t __pyx_v_class_index;
  Py_ssize_t __pyx_v_res_class_index;
  Py_ssize_t __pyx_v_res_priority_index;
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_linear_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_infection_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_finres_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_resource_list = 0;
  PyArrayObject *__pyx_v_finres_pop = 0;
  __Pyx_memviewslice __pyx_v_rate = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_term;
  double __pyx_v_term2;
  double __pyx_v_frp;
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  int __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  PyObject *__pyx_t_70 = NULL;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  PyObject *__pyx_t_79 = NULL;
  PyObject *__pyx_t_80 = NULL;
  double __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  PyObject *(*__pyx_t_97)(PyObject *);
  PyObject *__pyx_t_98 = NULL;
  PyObject *(*__pyx_t_99)(PyObject *);
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  __Pyx_RefNannySetupContext("jacobian", 0);

  /* "pyross/inference.pyx":4573
 *     cdef jacobian(self, double [:] x, double [:, :] l):
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim             # <<<<<<<<<<<<<<
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             Py_ssize_t resource_index, priority_index, probability_index, class_index, res_class_index, res_priority_index
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":4574
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']             # <<<<<<<<<<<<<<
 *             Py_ssize_t resource_index, priority_index, probability_index, class_index, res_class_index, res_priority_index
 *             double [:, :, :, :] J = self.J
 */
  if (unlikely(__pyx_v_self->__pyx_base.class_index_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 4574, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base.class_index_dict, __pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_S_index = __pyx_t_1;

  /* "pyross/inference.pyx":4576
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             Py_ssize_t resource_index, priority_index, probability_index, class_index, res_class_index, res_priority_index
 *             double [:, :, :, :] J = self.J             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.J), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4576, __pyx_L1_error)
  __pyx_v_J = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4577
 *             Py_ssize_t resource_index, priority_index, probability_index, class_index, res_class_index, res_priority_index
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4577, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":4578
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters             # <<<<<<<<<<<<<<
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:, :] finres_terms=self.finres_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->model_parameters), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4578, __pyx_L1_error)
  __pyx_v_parameters = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":4579
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms             # <<<<<<<<<<<<<<
 *             int [:, :] finres_terms=self.finres_terms
 *             np.ndarray resource_list=self.resource_list
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->linear_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4579, __pyx_L1_error)
  __pyx_v_linear_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->infection_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4579, __pyx_L1_error)
  __pyx_v_infection_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4580
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:, :] finres_terms=self.finres_terms             # <<<<<<<<<<<<<<
 *             np.ndarray resource_list=self.resource_list
 *             np.ndarray finres_pop = self.finres_pop
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->finres_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4580, __pyx_L1_error)
  __pyx_v_finres_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4581
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:, :] finres_terms=self.finres_terms
 *             np.ndarray resource_list=self.resource_list             # <<<<<<<<<<<<<<
 *             np.ndarray finres_pop = self.finres_pop
 *             double [:] rate
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->resource_list);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_resource_list = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4582
 *             int [:, :] finres_terms=self.finres_terms
 *             np.ndarray resource_list=self.resource_list
 *             np.ndarray finres_pop = self.finres_pop             # <<<<<<<<<<<<<<
 *             double [:] rate
 *             double term, term2, frp
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->finres_pop);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_finres_pop = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4585
 *             double [:] rate
 *             double term, term2, frp
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 * 
 *         # infection terms
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 4585, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":4588
 * 
 *         # infection terms
 *         for i in range(infection_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_infection_terms.shape[0]);
  __pyx_t_7 = __pyx_t_1;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyross/inference.pyx":4589
 *         # infection terms
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]             # <<<<<<<<<<<<<<
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_9 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_10 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4590
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]             # <<<<<<<<<<<<<<
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = 1;
    __pyx_v_infective_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_11 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_12 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4591
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M):
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_14 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_13 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_14 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4592
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 */
    __pyx_t_6.data = __pyx_v_parameters.data;
    __pyx_t_6.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 4592, __pyx_L1_error)
        __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_6.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_6.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_6.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_6;
    __pyx_t_6.memview = NULL;
    __pyx_t_6.data = NULL;

    /* "pyross/inference.pyx":4593
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:
 */
    __pyx_t_15 = __pyx_v_M;
    __pyx_t_16 = __pyx_t_15;
    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
      __pyx_v_m = __pyx_t_17;

      /* "pyross/inference.pyx":4594
 *             rate = parameters[rate_index]
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 */
      __pyx_t_18 = __pyx_v_m;
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_20 = __pyx_v_m;
      __pyx_t_21 = __pyx_v_S_index;
      __pyx_t_22 = __pyx_v_m;
      __pyx_t_23 = __pyx_v_S_index;
      __pyx_t_24 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_21 * __pyx_v_J.strides[0]) ) + __pyx_t_22 * __pyx_v_J.strides[1]) ) + __pyx_t_23 * __pyx_v_J.strides[2]) ) + __pyx_t_24 * __pyx_v_J.strides[3]) )) -= ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_18 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_19 * __pyx_v_l.strides[0]) ) + __pyx_t_20 * __pyx_v_l.strides[1]) ))));

      /* "pyross/inference.pyx":4595
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):
 */
      __pyx_t_25 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_25) {

        /* "pyross/inference.pyx":4596
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]             # <<<<<<<<<<<<<<
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 */
        __pyx_t_26 = __pyx_v_m;
        __pyx_t_27 = __pyx_v_i;
        __pyx_t_28 = __pyx_v_m;
        __pyx_t_29 = __pyx_v_product_index;
        __pyx_t_30 = __pyx_v_m;
        __pyx_t_31 = __pyx_v_S_index;
        __pyx_t_32 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_29 * __pyx_v_J.strides[0]) ) + __pyx_t_30 * __pyx_v_J.strides[1]) ) + __pyx_t_31 * __pyx_v_J.strides[2]) ) + __pyx_t_32 * __pyx_v_J.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_26 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_27 * __pyx_v_l.strides[0]) ) + __pyx_t_28 * __pyx_v_l.strides[1]) ))));

        /* "pyross/inference.pyx":4595
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):
 */
      }

      /* "pyross/inference.pyx":4597
 *                 if product_index>-1:
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):             # <<<<<<<<<<<<<<
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:
 */
      __pyx_t_33 = __pyx_v_M;
      __pyx_t_34 = __pyx_t_33;
      for (__pyx_t_35 = 0; __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
        __pyx_v_n = __pyx_t_35;

        /* "pyross/inference.pyx":4598
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                     if product_index>-1:
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 */
        __pyx_t_36 = ((__pyx_v_S_index * __pyx_v_M) + __pyx_v_m);
        __pyx_t_37 = __pyx_v_m;
        __pyx_t_38 = __pyx_v_m;
        __pyx_t_39 = __pyx_v_n;
        __pyx_t_40 = __pyx_v_n;
        __pyx_t_41 = __pyx_v_S_index;
        __pyx_t_42 = __pyx_v_m;
        __pyx_t_43 = __pyx_v_infective_index;
        __pyx_t_44 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_41 * __pyx_v_J.strides[0]) ) + __pyx_t_42 * __pyx_v_J.strides[1]) ) + __pyx_t_43 * __pyx_v_J.strides[2]) ) + __pyx_t_44 * __pyx_v_J.strides[3]) )) -= ((((*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_36 * __pyx_v_x.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_37 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_38 * __pyx_v_CM.strides[0]) ) + __pyx_t_39 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_40 * __pyx_v_fi.strides[0]) ))));

        /* "pyross/inference.pyx":4599
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 * 
 */
        __pyx_t_25 = ((__pyx_v_product_index > -1L) != 0);
        if (__pyx_t_25) {

          /* "pyross/inference.pyx":4600
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 * 
 *         # linear terms
 */
          __pyx_t_45 = ((__pyx_v_S_index * __pyx_v_M) + __pyx_v_m);
          __pyx_t_46 = __pyx_v_m;
          __pyx_t_47 = __pyx_v_m;
          __pyx_t_48 = __pyx_v_n;
          __pyx_t_49 = __pyx_v_n;
          __pyx_t_50 = __pyx_v_product_index;
          __pyx_t_51 = __pyx_v_m;
          __pyx_t_52 = __pyx_v_infective_index;
          __pyx_t_53 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_50 * __pyx_v_J.strides[0]) ) + __pyx_t_51 * __pyx_v_J.strides[1]) ) + __pyx_t_52 * __pyx_v_J.strides[2]) ) + __pyx_t_53 * __pyx_v_J.strides[3]) )) += ((((*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_45 * __pyx_v_x.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_46 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_47 * __pyx_v_CM.strides[0]) ) + __pyx_t_48 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_49 * __pyx_v_fi.strides[0]) ))));

          /* "pyross/inference.pyx":4599
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 * 
 */
        }
      }
    }
  }

  /* "pyross/inference.pyx":4603
 * 
 *         # linear terms
 *         for i in range(linear_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_linear_terms.shape[0]);
  __pyx_t_7 = __pyx_t_1;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyross/inference.pyx":4604
 *         # linear terms
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]             # <<<<<<<<<<<<<<
 *             reagent_index = linear_terms[i, 1]
 *             rate_index = linear_terms[i, 0]
 */
    __pyx_t_54 = __pyx_v_i;
    __pyx_t_55 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_54 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_55 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":4605
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]             # <<<<<<<<<<<<<<
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_56 = __pyx_v_i;
    __pyx_t_57 = 1;
    __pyx_v_reagent_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_56 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_57 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":4606
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 *             rate_index = linear_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M):
 */
    __pyx_t_58 = __pyx_v_i;
    __pyx_t_59 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_58 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_59 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":4607
 *             reagent_index = linear_terms[i, 1]
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 */
    __pyx_t_6.data = __pyx_v_parameters.data;
    __pyx_t_6.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 4607, __pyx_L1_error)
        __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_6.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_6.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_6.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_6;
    __pyx_t_6.memview = NULL;
    __pyx_t_6.data = NULL;

    /* "pyross/inference.pyx":4608
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 if product_index>-1:
 */
    __pyx_t_15 = __pyx_v_M;
    __pyx_t_16 = __pyx_t_15;
    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
      __pyx_v_m = __pyx_t_17;

      /* "pyross/inference.pyx":4609
 *             rate = parameters[rate_index]
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     J[product_index, m, reagent_index, m] += rate[m]
 */
      __pyx_t_60 = __pyx_v_m;
      __pyx_t_61 = __pyx_v_reagent_index;
      __pyx_t_62 = __pyx_v_m;
      __pyx_t_63 = __pyx_v_reagent_index;
      __pyx_t_64 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_61 * __pyx_v_J.strides[0]) ) + __pyx_t_62 * __pyx_v_J.strides[1]) ) + __pyx_t_63 * __pyx_v_J.strides[2]) ) + __pyx_t_64 * __pyx_v_J.strides[3]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_60 * __pyx_v_rate.strides[0]) )));

      /* "pyross/inference.pyx":4610
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, reagent_index, m] += rate[m]
 * 
 */
      __pyx_t_25 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_25) {

        /* "pyross/inference.pyx":4611
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 if product_index>-1:
 *                     J[product_index, m, reagent_index, m] += rate[m]             # <<<<<<<<<<<<<<
 * 
 *         # finite-resource terms
 */
        __pyx_t_65 = __pyx_v_m;
        __pyx_t_66 = __pyx_v_product_index;
        __pyx_t_67 = __pyx_v_m;
        __pyx_t_68 = __pyx_v_reagent_index;
        __pyx_t_69 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_66 * __pyx_v_J.strides[0]) ) + __pyx_t_67 * __pyx_v_J.strides[1]) ) + __pyx_t_68 * __pyx_v_J.strides[2]) ) + __pyx_t_69 * __pyx_v_J.strides[3]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_65 * __pyx_v_rate.strides[0]) )));

        /* "pyross/inference.pyx":4610
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, reagent_index, m] += rate[m]
 * 
 */
      }
    }
  }

  /* "pyross/inference.pyx":4614
 * 
 *         # finite-resource terms
 *         if finres_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]
 */
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_finres_terms, 2, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_70 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_size); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_70);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_70, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4614, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
  __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_25 < 0)) __PYX_ERR(0, 4614, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_25) {

    /* "pyross/inference.pyx":4615
 *         # finite-resource terms
 *         if finres_terms.size > 0:
 *             for i in range(finres_terms.shape[0]):             # <<<<<<<<<<<<<<
 *                 resource_index = finres_terms[i, 0]
 *                 rate_index = resource_list[resource_index][0]
 */
    __pyx_t_1 = (__pyx_v_finres_terms.shape[0]);
    __pyx_t_7 = __pyx_t_1;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "pyross/inference.pyx":4616
 *         if finres_terms.size > 0:
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]             # <<<<<<<<<<<<<<
 *                 rate_index = resource_list[resource_index][0]
 *                 priority_index = finres_terms[i, 1]
 */
      __pyx_t_71 = __pyx_v_i;
      __pyx_t_72 = 0;
      __pyx_v_resource_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_71 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_72 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4617
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]
 *                 rate_index = resource_list[resource_index][0]             # <<<<<<<<<<<<<<
 *                 priority_index = finres_terms[i, 1]
 *                 probability_index = finres_terms[i, 2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_resource_list), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4617, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_70 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4617, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_70);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_70); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4617, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
      __pyx_v_rate_index = __pyx_t_15;

      /* "pyross/inference.pyx":4618
 *                 resource_index = finres_terms[i, 0]
 *                 rate_index = resource_list[resource_index][0]
 *                 priority_index = finres_terms[i, 1]             # <<<<<<<<<<<<<<
 *                 probability_index = finres_terms[i, 2]
 *                 class_index = finres_terms[i, 3]
 */
      __pyx_t_73 = __pyx_v_i;
      __pyx_t_74 = 1;
      __pyx_v_priority_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_73 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_74 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4619
 *                 rate_index = resource_list[resource_index][0]
 *                 priority_index = finres_terms[i, 1]
 *                 probability_index = finres_terms[i, 2]             # <<<<<<<<<<<<<<
 *                 class_index = finres_terms[i, 3]
 *                 reagent_index = self.finres_terms[i, 4]
 */
      __pyx_t_75 = __pyx_v_i;
      __pyx_t_76 = 2;
      __pyx_v_probability_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_75 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_76 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4620
 *                 priority_index = finres_terms[i, 1]
 *                 probability_index = finres_terms[i, 2]
 *                 class_index = finres_terms[i, 3]             # <<<<<<<<<<<<<<
 *                 reagent_index = self.finres_terms[i, 4]
 *                 product_index = self.finres_terms[i, 5]
 */
      __pyx_t_77 = __pyx_v_i;
      __pyx_t_78 = 3;
      __pyx_v_class_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_77 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_78 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4621
 *                 probability_index = finres_terms[i, 2]
 *                 class_index = finres_terms[i, 3]
 *                 reagent_index = self.finres_terms[i, 4]             # <<<<<<<<<<<<<<
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):
 */
      __pyx_t_70 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_70);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_70);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_70);
      __Pyx_INCREF(__pyx_int_4);
      __Pyx_GIVEREF(__pyx_int_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_4);
      __pyx_t_70 = 0;
      __pyx_t_70 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->finres_terms), __pyx_t_2); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_70);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_70); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4621, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
      __pyx_v_reagent_index = __pyx_t_15;

      /* "pyross/inference.pyx":4622
 *                 class_index = finres_terms[i, 3]
 *                 reagent_index = self.finres_terms[i, 4]
 *                 product_index = self.finres_terms[i, 5]             # <<<<<<<<<<<<<<
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:
 */
      __pyx_t_70 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_70);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_70);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_70);
      __Pyx_INCREF(__pyx_int_5);
      __Pyx_GIVEREF(__pyx_int_5);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_5);
      __pyx_t_70 = 0;
      __pyx_t_70 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->finres_terms), __pyx_t_2); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_70);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_70); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4622, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
      __pyx_v_product_index = __pyx_t_15;

      /* "pyross/inference.pyx":4623
 *                 reagent_index = self.finres_terms[i, 4]
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):             # <<<<<<<<<<<<<<
 *                     if np.size(finres_pop[resource_index]) == 1:
 *                         frp = finres_pop[resource_index]
 */
      __pyx_t_15 = __pyx_v_M;
      __pyx_t_16 = __pyx_t_15;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_m = __pyx_t_17;

        /* "pyross/inference.pyx":4624
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:             # <<<<<<<<<<<<<<
 *                         frp = finres_pop[resource_index]
 *                     else:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_79 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_size); if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_79);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_80 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_79))) {
          __pyx_t_80 = PyMethod_GET_SELF(__pyx_t_79);
          if (likely(__pyx_t_80)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_79);
            __Pyx_INCREF(__pyx_t_80);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_79, function);
          }
        }
        __pyx_t_70 = (__pyx_t_80) ? __Pyx_PyObject_Call2Args(__pyx_t_79, __pyx_t_80, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_79, __pyx_t_2);
        __Pyx_XDECREF(__pyx_t_80); __pyx_t_80 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_70);
        __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
        __pyx_t_79 = __Pyx_PyInt_EqObjC(__pyx_t_70, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_79);
        __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
        __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_t_79); if (unlikely(__pyx_t_25 < 0)) __PYX_ERR(0, 4624, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
        if (__pyx_t_25) {

          /* "pyross/inference.pyx":4625
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:
 *                         frp = finres_pop[resource_index]             # <<<<<<<<<<<<<<
 *                     else:
 *                         frp = finres_pop[resource_index][m]
 */
          __pyx_t_79 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_79);
          __pyx_t_81 = __pyx_PyFloat_AsDouble(__pyx_t_79); if (unlikely((__pyx_t_81 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4625, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
          __pyx_v_frp = __pyx_t_81;

          /* "pyross/inference.pyx":4624
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:             # <<<<<<<<<<<<<<
 *                         frp = finres_pop[resource_index]
 *                     else:
 */
          goto __pyx_L21;
        }

        /* "pyross/inference.pyx":4627
 *                         frp = finres_pop[resource_index]
 *                     else:
 *                         frp = finres_pop[resource_index][m]             # <<<<<<<<<<<<<<
 *                     if frp > 0.5 / self.Omega:
 *                         term = parameters[rate_index, m] * parameters[priority_index, m] \
 */
        /*else*/ {
          __pyx_t_79 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_79);
          __pyx_t_70 = __Pyx_GetItemInt(__pyx_t_79, __pyx_v_m, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_70);
          __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
          __pyx_t_81 = __pyx_PyFloat_AsDouble(__pyx_t_70); if (unlikely((__pyx_t_81 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4627, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
          __pyx_v_frp = __pyx_t_81;
        }
        __pyx_L21:;

        /* "pyross/inference.pyx":4628
 *                     else:
 *                         frp = finres_pop[resource_index][m]
 *                     if frp > 0.5 / self.Omega:             # <<<<<<<<<<<<<<
 *                         term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                                * parameters[probability_index, m] / (frp * self.Omega)
 */
        __pyx_t_25 = ((__pyx_v_frp > (0.5 / __pyx_v_self->__pyx_base.Omega)) != 0);
        if (__pyx_t_25) {

          /* "pyross/inference.pyx":4629
 *                         frp = finres_pop[resource_index][m]
 *                     if frp > 0.5 / self.Omega:
 *                         term = parameters[rate_index, m] * parameters[priority_index, m] \             # <<<<<<<<<<<<<<
 *                                * parameters[probability_index, m] / (frp * self.Omega)
 *                     else:
 */
          __pyx_t_82 = __pyx_v_rate_index;
          __pyx_t_83 = __pyx_v_m;
          __pyx_t_84 = __pyx_v_priority_index;
          __pyx_t_85 = __pyx_v_m;

          /* "pyross/inference.pyx":4630
 *                     if frp > 0.5 / self.Omega:
 *                         term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                                * parameters[probability_index, m] / (frp * self.Omega)             # <<<<<<<<<<<<<<
 *                     else:
 *                         term = 0
 */
          __pyx_t_86 = __pyx_v_probability_index;
          __pyx_t_87 = __pyx_v_m;
          __pyx_v_term = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_82 * __pyx_v_parameters.strides[0]) ) + __pyx_t_83 * __pyx_v_parameters.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_84 * __pyx_v_parameters.strides[0]) ) + __pyx_t_85 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_86 * __pyx_v_parameters.strides[0]) ) + __pyx_t_87 * __pyx_v_parameters.strides[1]) )))) / (__pyx_v_frp * __pyx_v_self->__pyx_base.Omega));

          /* "pyross/inference.pyx":4628
 *                     else:
 *                         frp = finres_pop[resource_index][m]
 *                     if frp > 0.5 / self.Omega:             # <<<<<<<<<<<<<<
 *                         term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                                * parameters[probability_index, m] / (frp * self.Omega)
 */
          goto __pyx_L22;
        }

        /* "pyross/inference.pyx":4632
 *                                * parameters[probability_index, m] / (frp * self.Omega)
 *                     else:
 *                         term = 0             # <<<<<<<<<<<<<<
 *                     if reagent_index>-1:
 *                         J[reagent_index, m, class_index, m] -= term
 */
        /*else*/ {
          __pyx_v_term = 0.0;
        }
        __pyx_L22:;

        /* "pyross/inference.pyx":4633
 *                     else:
 *                         term = 0
 *                     if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                         J[reagent_index, m, class_index, m] -= term
 *                     if product_index>-1:
 */
        __pyx_t_25 = ((__pyx_v_reagent_index > -1L) != 0);
        if (__pyx_t_25) {

          /* "pyross/inference.pyx":4634
 *                         term = 0
 *                     if reagent_index>-1:
 *                         J[reagent_index, m, class_index, m] -= term             # <<<<<<<<<<<<<<
 *                     if product_index>-1:
 *                         J[product_index, m, class_index, m] += term
 */
          __pyx_t_88 = __pyx_v_reagent_index;
          __pyx_t_89 = __pyx_v_m;
          __pyx_t_90 = __pyx_v_class_index;
          __pyx_t_91 = __pyx_v_m;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_88 * __pyx_v_J.strides[0]) ) + __pyx_t_89 * __pyx_v_J.strides[1]) ) + __pyx_t_90 * __pyx_v_J.strides[2]) ) + __pyx_t_91 * __pyx_v_J.strides[3]) )) -= __pyx_v_term;

          /* "pyross/inference.pyx":4633
 *                     else:
 *                         term = 0
 *                     if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                         J[reagent_index, m, class_index, m] -= term
 *                     if product_index>-1:
 */
        }

        /* "pyross/inference.pyx":4635
 *                     if reagent_index>-1:
 *                         J[reagent_index, m, class_index, m] -= term
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         J[product_index, m, class_index, m] += term
 *                     if frp > 0:
 */
        __pyx_t_25 = ((__pyx_v_product_index > -1L) != 0);
        if (__pyx_t_25) {

          /* "pyross/inference.pyx":4636
 *                         J[reagent_index, m, class_index, m] -= term
 *                     if product_index>-1:
 *                         J[product_index, m, class_index, m] += term             # <<<<<<<<<<<<<<
 *                     if frp > 0:
 *                         term *= - x[class_index*M+m] / frp
 */
          __pyx_t_92 = __pyx_v_product_index;
          __pyx_t_93 = __pyx_v_m;
          __pyx_t_94 = __pyx_v_class_index;
          __pyx_t_95 = __pyx_v_m;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_92 * __pyx_v_J.strides[0]) ) + __pyx_t_93 * __pyx_v_J.strides[1]) ) + __pyx_t_94 * __pyx_v_J.strides[2]) ) + __pyx_t_95 * __pyx_v_J.strides[3]) )) += __pyx_v_term;

          /* "pyross/inference.pyx":4635
 *                     if reagent_index>-1:
 *                         J[reagent_index, m, class_index, m] -= term
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         J[product_index, m, class_index, m] += term
 *                     if frp > 0:
 */
        }

        /* "pyross/inference.pyx":4637
 *                     if product_index>-1:
 *                         J[product_index, m, class_index, m] += term
 *                     if frp > 0:             # <<<<<<<<<<<<<<
 *                         term *= - x[class_index*M+m] / frp
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:
 */
        __pyx_t_25 = ((__pyx_v_frp > 0.0) != 0);
        if (__pyx_t_25) {

          /* "pyross/inference.pyx":4638
 *                         J[product_index, m, class_index, m] += term
 *                     if frp > 0:
 *                         term *= - x[class_index*M+m] / frp             # <<<<<<<<<<<<<<
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:
 *                         if np.size(finres_pop[resource_index]) == 1:
 */
          __pyx_t_96 = ((__pyx_v_class_index * __pyx_v_M) + __pyx_v_m);
          __pyx_v_term = (__pyx_v_term * ((-(*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_96 * __pyx_v_x.strides[0]) )))) / __pyx_v_frp));

          /* "pyross/inference.pyx":4637
 *                     if product_index>-1:
 *                         J[product_index, m, class_index, m] += term
 *                     if frp > 0:             # <<<<<<<<<<<<<<
 *                         term *= - x[class_index*M+m] / frp
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:
 */
        }

        /* "pyross/inference.pyx":4639
 *                     if frp > 0:
 *                         term *= - x[class_index*M+m] / frp
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:             # <<<<<<<<<<<<<<
 *                         if np.size(finres_pop[resource_index]) == 1:
 *                             for n in range(M):
 */
        __pyx_t_70 = __Pyx_GetItemInt(((PyObject *)__pyx_v_resource_list), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4639, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_70);
        __pyx_t_79 = __Pyx_PyObject_GetSlice(__pyx_t_70, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 0); if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4639, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_79);
        __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
        if (likely(PyList_CheckExact(__pyx_t_79)) || PyTuple_CheckExact(__pyx_t_79)) {
          __pyx_t_70 = __pyx_t_79; __Pyx_INCREF(__pyx_t_70); __pyx_t_33 = 0;
          __pyx_t_97 = NULL;
        } else {
          __pyx_t_33 = -1; __pyx_t_70 = PyObject_GetIter(__pyx_t_79); if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_70);
          __pyx_t_97 = Py_TYPE(__pyx_t_70)->tp_iternext; if (unlikely(!__pyx_t_97)) __PYX_ERR(0, 4639, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
        for (;;) {
          if (likely(!__pyx_t_97)) {
            if (likely(PyList_CheckExact(__pyx_t_70))) {
              if (__pyx_t_33 >= PyList_GET_SIZE(__pyx_t_70)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_79 = PyList_GET_ITEM(__pyx_t_70, __pyx_t_33); __Pyx_INCREF(__pyx_t_79); __pyx_t_33++; if (unlikely(0 < 0)) __PYX_ERR(0, 4639, __pyx_L1_error)
              #else
              __pyx_t_79 = PySequence_ITEM(__pyx_t_70, __pyx_t_33); __pyx_t_33++; if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4639, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_79);
              #endif
            } else {
              if (__pyx_t_33 >= PyTuple_GET_SIZE(__pyx_t_70)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_79 = PyTuple_GET_ITEM(__pyx_t_70, __pyx_t_33); __Pyx_INCREF(__pyx_t_79); __pyx_t_33++; if (unlikely(0 < 0)) __PYX_ERR(0, 4639, __pyx_L1_error)
              #else
              __pyx_t_79 = PySequence_ITEM(__pyx_t_70, __pyx_t_33); __pyx_t_33++; if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4639, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_79);
              #endif
            }
          } else {
            __pyx_t_79 = __pyx_t_97(__pyx_t_70);
            if (unlikely(!__pyx_t_79)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 4639, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_79);
          }
          if ((likely(PyTuple_CheckExact(__pyx_t_79))) || (PyList_CheckExact(__pyx_t_79))) {
            PyObject* sequence = __pyx_t_79;
            Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 4639, __pyx_L1_error)
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_80 = PyTuple_GET_ITEM(sequence, 1); 
            } else {
              __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_80 = PyList_GET_ITEM(sequence, 1); 
            }
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_80);
            #else
            __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4639, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_80 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_80)) __PYX_ERR(0, 4639, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_80);
            #endif
            __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_98 = PyObject_GetIter(__pyx_t_79); if (unlikely(!__pyx_t_98)) __PYX_ERR(0, 4639, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_98);
            __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
            __pyx_t_99 = Py_TYPE(__pyx_t_98)->tp_iternext;
            index = 0; __pyx_t_2 = __pyx_t_99(__pyx_t_98); if (unlikely(!__pyx_t_2)) goto __pyx_L28_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_2);
            index = 1; __pyx_t_80 = __pyx_t_99(__pyx_t_98); if (unlikely(!__pyx_t_80)) goto __pyx_L28_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_80);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_99(__pyx_t_98), 2) < 0) __PYX_ERR(0, 4639, __pyx_L1_error)
            __pyx_t_99 = NULL;
            __Pyx_DECREF(__pyx_t_98); __pyx_t_98 = 0;
            goto __pyx_L29_unpacking_done;
            __pyx_L28_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_98); __pyx_t_98 = 0;
            __pyx_t_99 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 4639, __pyx_L1_error)
            __pyx_L29_unpacking_done:;
          }
          __pyx_t_34 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_34 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4639, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_35 = __Pyx_PyIndex_AsSsize_t(__pyx_t_80); if (unlikely((__pyx_t_35 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4639, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_80); __pyx_t_80 = 0;
          __pyx_v_res_class_index = __pyx_t_34;
          __pyx_v_res_priority_index = __pyx_t_35;

          /* "pyross/inference.pyx":4640
 *                         term *= - x[class_index*M+m] / frp
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:
 *                         if np.size(finres_pop[resource_index]) == 1:             # <<<<<<<<<<<<<<
 *                             for n in range(M):
 *                                 term2 = term * parameters[res_priority_index, n]
 */
          __Pyx_GetModuleGlobalName(__pyx_t_80, __pyx_n_s_np); if (unlikely(!__pyx_t_80)) __PYX_ERR(0, 4640, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_80);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_80, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4640, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_80); __pyx_t_80 = 0;
          __pyx_t_80 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_80)) __PYX_ERR(0, 4640, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_80);
          __pyx_t_98 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_98 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_98)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_98);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_79 = (__pyx_t_98) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_98, __pyx_t_80) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_80);
          __Pyx_XDECREF(__pyx_t_98); __pyx_t_98 = 0;
          __Pyx_DECREF(__pyx_t_80); __pyx_t_80 = 0;
          if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4640, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_79);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_79, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4640, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0;
          __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_25 < 0)) __PYX_ERR(0, 4640, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_25) {

            /* "pyross/inference.pyx":4641
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:
 *                         if np.size(finres_pop[resource_index]) == 1:
 *                             for n in range(M):             # <<<<<<<<<<<<<<
 *                                 term2 = term * parameters[res_priority_index, n]
 *                                 if reagent_index>-1:
 */
            __pyx_t_35 = __pyx_v_M;
            __pyx_t_34 = __pyx_t_35;
            for (__pyx_t_100 = 0; __pyx_t_100 < __pyx_t_34; __pyx_t_100+=1) {
              __pyx_v_n = __pyx_t_100;

              /* "pyross/inference.pyx":4642
 *                         if np.size(finres_pop[resource_index]) == 1:
 *                             for n in range(M):
 *                                 term2 = term * parameters[res_priority_index, n]             # <<<<<<<<<<<<<<
 *                                 if reagent_index>-1:
 *                                     J[reagent_index, m, res_class_index, n] -= term2
 */
              __pyx_t_101 = __pyx_v_res_priority_index;
              __pyx_t_102 = __pyx_v_n;
              __pyx_v_term2 = (__pyx_v_term * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_101 * __pyx_v_parameters.strides[0]) ) + __pyx_t_102 * __pyx_v_parameters.strides[1]) ))));

              /* "pyross/inference.pyx":4643
 *                             for n in range(M):
 *                                 term2 = term * parameters[res_priority_index, n]
 *                                 if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                                     J[reagent_index, m, res_class_index, n] -= term2
 *                                 if product_index>-1:
 */
              __pyx_t_25 = ((__pyx_v_reagent_index > -1L) != 0);
              if (__pyx_t_25) {

                /* "pyross/inference.pyx":4644
 *                                 term2 = term * parameters[res_priority_index, n]
 *                                 if reagent_index>-1:
 *                                     J[reagent_index, m, res_class_index, n] -= term2             # <<<<<<<<<<<<<<
 *                                 if product_index>-1:
 *                                     J[product_index, m, res_class_index, n] += term2
 */
                __pyx_t_103 = __pyx_v_reagent_index;
                __pyx_t_104 = __pyx_v_m;
                __pyx_t_105 = __pyx_v_res_class_index;
                __pyx_t_106 = __pyx_v_n;
                *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_103 * __pyx_v_J.strides[0]) ) + __pyx_t_104 * __pyx_v_J.strides[1]) ) + __pyx_t_105 * __pyx_v_J.strides[2]) ) + __pyx_t_106 * __pyx_v_J.strides[3]) )) -= __pyx_v_term2;

                /* "pyross/inference.pyx":4643
 *                             for n in range(M):
 *                                 term2 = term * parameters[res_priority_index, n]
 *                                 if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                                     J[reagent_index, m, res_class_index, n] -= term2
 *                                 if product_index>-1:
 */
              }

              /* "pyross/inference.pyx":4645
 *                                 if reagent_index>-1:
 *                                     J[reagent_index, m, res_class_index, n] -= term2
 *                                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                                     J[product_index, m, res_class_index, n] += term2
 *                         else:
 */
              __pyx_t_25 = ((__pyx_v_product_index > -1L) != 0);
              if (__pyx_t_25) {

                /* "pyross/inference.pyx":4646
 *                                     J[reagent_index, m, res_class_index, n] -= term2
 *                                 if product_index>-1:
 *                                     J[product_index, m, res_class_index, n] += term2             # <<<<<<<<<<<<<<
 *                         else:
 *                             term2 = term * parameters[res_priority_index, m]
 */
                __pyx_t_107 = __pyx_v_product_index;
                __pyx_t_108 = __pyx_v_m;
                __pyx_t_109 = __pyx_v_res_class_index;
                __pyx_t_110 = __pyx_v_n;
                *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_107 * __pyx_v_J.strides[0]) ) + __pyx_t_108 * __pyx_v_J.strides[1]) ) + __pyx_t_109 * __pyx_v_J.strides[2]) ) + __pyx_t_110 * __pyx_v_J.strides[3]) )) += __pyx_v_term2;

                /* "pyross/inference.pyx":4645
 *                                 if reagent_index>-1:
 *                                     J[reagent_index, m, res_class_index, n] -= term2
 *                                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                                     J[product_index, m, res_class_index, n] += term2
 *                         else:
 */
              }
            }

            /* "pyross/inference.pyx":4640
 *                         term *= - x[class_index*M+m] / frp
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:
 *                         if np.size(finres_pop[resource_index]) == 1:             # <<<<<<<<<<<<<<
 *                             for n in range(M):
 *                                 term2 = term * parameters[res_priority_index, n]
 */
            goto __pyx_L30;
          }

          /* "pyross/inference.pyx":4648
 *                                     J[product_index, m, res_class_index, n] += term2
 *                         else:
 *                             term2 = term * parameters[res_priority_index, m]             # <<<<<<<<<<<<<<
 *                             if reagent_index>-1:
 *                                 J[reagent_index, m, res_class_index, m] -= term2
 */
          /*else*/ {
            __pyx_t_111 = __pyx_v_res_priority_index;
            __pyx_t_112 = __pyx_v_m;
            __pyx_v_term2 = (__pyx_v_term * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_111 * __pyx_v_parameters.strides[0]) ) + __pyx_t_112 * __pyx_v_parameters.strides[1]) ))));

            /* "pyross/inference.pyx":4649
 *                         else:
 *                             term2 = term * parameters[res_priority_index, m]
 *                             if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                                 J[reagent_index, m, res_class_index, m] -= term2
 *                             if product_index>-1:
 */
            __pyx_t_25 = ((__pyx_v_reagent_index > -1L) != 0);
            if (__pyx_t_25) {

              /* "pyross/inference.pyx":4650
 *                             term2 = term * parameters[res_priority_index, m]
 *                             if reagent_index>-1:
 *                                 J[reagent_index, m, res_class_index, m] -= term2             # <<<<<<<<<<<<<<
 *                             if product_index>-1:
 *                                 J[product_index, m, res_class_index, m] += term2
 */
              __pyx_t_113 = __pyx_v_reagent_index;
              __pyx_t_114 = __pyx_v_m;
              __pyx_t_115 = __pyx_v_res_class_index;
              __pyx_t_116 = __pyx_v_m;
              *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_113 * __pyx_v_J.strides[0]) ) + __pyx_t_114 * __pyx_v_J.strides[1]) ) + __pyx_t_115 * __pyx_v_J.strides[2]) ) + __pyx_t_116 * __pyx_v_J.strides[3]) )) -= __pyx_v_term2;

              /* "pyross/inference.pyx":4649
 *                         else:
 *                             term2 = term * parameters[res_priority_index, m]
 *                             if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                                 J[reagent_index, m, res_class_index, m] -= term2
 *                             if product_index>-1:
 */
            }

            /* "pyross/inference.pyx":4651
 *                             if reagent_index>-1:
 *                                 J[reagent_index, m, res_class_index, m] -= term2
 *                             if product_index>-1:             # <<<<<<<<<<<<<<
 *                                 J[product_index, m, res_class_index, m] += term2
 * 
 */
            __pyx_t_25 = ((__pyx_v_product_index > -1L) != 0);
            if (__pyx_t_25) {

              /* "pyross/inference.pyx":4652
 *                                 J[reagent_index, m, res_class_index, m] -= term2
 *                             if product_index>-1:
 *                                 J[product_index, m, res_class_index, m] += term2             # <<<<<<<<<<<<<<
 * 
 * 
 */
              __pyx_t_117 = __pyx_v_product_index;
              __pyx_t_118 = __pyx_v_m;
              __pyx_t_119 = __pyx_v_res_class_index;
              __pyx_t_120 = __pyx_v_m;
              *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_117 * __pyx_v_J.strides[0]) ) + __pyx_t_118 * __pyx_v_J.strides[1]) ) + __pyx_t_119 * __pyx_v_J.strides[2]) ) + __pyx_t_120 * __pyx_v_J.strides[3]) )) += __pyx_v_term2;

              /* "pyross/inference.pyx":4651
 *                             if reagent_index>-1:
 *                                 J[reagent_index, m, res_class_index, m] -= term2
 *                             if product_index>-1:             # <<<<<<<<<<<<<<
 *                                 J[product_index, m, res_class_index, m] += term2
 * 
 */
            }
          }
          __pyx_L30:;

          /* "pyross/inference.pyx":4639
 *                     if frp > 0:
 *                         term *= - x[class_index*M+m] / frp
 *                     for (res_class_index, res_priority_index) in resource_list[resource_index][1:]:             # <<<<<<<<<<<<<<
 *                         if np.size(finres_pop[resource_index]) == 1:
 *                             for n in range(M):
 */
        }
        __Pyx_DECREF(__pyx_t_70); __pyx_t_70 = 0;
      }
    }

    /* "pyross/inference.pyx":4614
 * 
 *         # finite-resource terms
 *         if finres_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]
 */
  }

  /* "pyross/inference.pyx":4655
 * 
 * 
 *         self.J_mat = self.J.reshape((dim, dim))             # <<<<<<<<<<<<<<
 * 
 *     cdef noise_correlation(self, double [:] x, double [:, :] l):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.J), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_79 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_79)) __PYX_ERR(0, 4655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_79);
  __pyx_t_80 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_80)) __PYX_ERR(0, 4655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_80);
  __pyx_t_98 = PyTuple_New(2); if (unlikely(!__pyx_t_98)) __PYX_ERR(0, 4655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_98);
  __Pyx_GIVEREF(__pyx_t_79);
  PyTuple_SET_ITEM(__pyx_t_98, 0, __pyx_t_79);
  __Pyx_GIVEREF(__pyx_t_80);
  PyTuple_SET_ITEM(__pyx_t_98, 1, __pyx_t_80);
  __pyx_t_79 = 0;
  __pyx_t_80 = 0;
  __pyx_t_80 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_80 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_80)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_80);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_70 = (__pyx_t_80) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_80, __pyx_t_98) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_98);
  __Pyx_XDECREF(__pyx_t_80); __pyx_t_80 = 0;
  __Pyx_DECREF(__pyx_t_98); __pyx_t_98 = 0;
  if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 4655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_70);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_70) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_70, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4655, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_70);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __pyx_v_self->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_70);
  __pyx_t_70 = 0;

  /* "pyross/inference.pyx":4571
 *                         self.finres_pop[i][m] += x[m + self.M*class_index] * self.model_parameters[priority_index, m]
 * 
 *     cdef jacobian(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __Pyx_XDECREF(__pyx_t_70);
  __Pyx_XDECREF(__pyx_t_79);
  __Pyx_XDECREF(__pyx_t_80);
  __Pyx_XDECREF(__pyx_t_98);
  __Pyx_AddTraceback("pyross.inference.Spp.jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_parameters, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_linear_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_infection_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_finres_terms, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_resource_list);
  __Pyx_XDECREF((PyObject *)__pyx_v_finres_pop);
  __PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4657
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, nClass=self.nClass, class_index
 */

static PyObject *__pyx_f_6pyross_9inference_3Spp_noise_correlation(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_nClass;
  Py_ssize_t __pyx_v_class_index;
  Py_ssize_t __pyx_v_rate_index;
  CYTHON_UNUSED Py_ssize_t __pyx_v_infective_index;
  Py_ssize_t __pyx_v_product_index;
  Py_ssize_t __pyx_v_reagent_index;
  Py_ssize_t __pyx_v_S_index;
  Py_ssize_t __pyx_v_resource_index;
  Py_ssize_t __pyx_v_priority_index;
  Py_ssize_t __pyx_v_probability_index;
  __Pyx_memviewslice __pyx_v_B = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_constant_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_linear_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_infection_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_finres_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_resource_list = 0;
  PyArrayObject *__pyx_v_finres_pop = 0;
  double __pyx_v_frp;
  __Pyx_memviewslice __pyx_v_s = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_reagent = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_rate = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_Omega;
  PyObject *__pyx_v_term = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_6;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  PyObject *__pyx_t_106 = NULL;
  PyObject *__pyx_t_107 = NULL;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  Py_ssize_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  PyObject *__pyx_t_131 = NULL;
  __Pyx_RefNannySetupContext("noise_correlation", 0);

  /* "pyross/inference.pyx":4659
 *     cdef noise_correlation(self, double [:] x, double [:, :] l):
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, nClass=self.nClass, class_index             # <<<<<<<<<<<<<<
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             Py_ssize_t resource_index, priority_index, probability_index
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.nClass;
  __pyx_v_nClass = __pyx_t_1;

  /* "pyross/inference.pyx":4660
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, nClass=self.nClass, class_index
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']             # <<<<<<<<<<<<<<
 *             Py_ssize_t resource_index, priority_index, probability_index
 *             double [:, :, :, :] B=self.B
 */
  if (unlikely(__pyx_v_self->__pyx_base.class_index_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 4660, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base.class_index_dict, __pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4660, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_S_index = __pyx_t_1;

  /* "pyross/inference.pyx":4662
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             Py_ssize_t resource_index, priority_index, probability_index
 *             double [:, :, :, :] B=self.B             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.B), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4662, __pyx_L1_error)
  __pyx_v_B = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":4663
 *             Py_ssize_t resource_index, priority_index, probability_index
 *             double [:, :, :, :] B=self.B
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] constant_terms=self.constant_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4663, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":4664
 *             double [:, :, :, :] B=self.B
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters             # <<<<<<<<<<<<<<
 *             int [:, :] constant_terms=self.constant_terms
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->model_parameters), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4664, __pyx_L1_error)
  __pyx_v_parameters = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":4665
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] constant_terms=self.constant_terms             # <<<<<<<<<<<<<<
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:, :] finres_terms=self.finres_terms
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->constant_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4665, __pyx_L1_error)
  __pyx_v_constant_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4666
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] constant_terms=self.constant_terms
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms             # <<<<<<<<<<<<<<
 *             int [:, :] finres_terms=self.finres_terms
 *             np.ndarray resource_list=self.resource_list
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->linear_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4666, __pyx_L1_error)
  __pyx_v_linear_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->infection_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4666, __pyx_L1_error)
  __pyx_v_infection_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4667
 *             int [:, :] constant_terms=self.constant_terms
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:, :] finres_terms=self.finres_terms             # <<<<<<<<<<<<<<
 *             np.ndarray resource_list=self.resource_list
 *             np.ndarray finres_pop = self.finres_pop
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->finres_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 4667, __pyx_L1_error)
  __pyx_v_finres_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":4668
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:, :] finres_terms=self.finres_terms
 *             np.ndarray resource_list=self.resource_list             # <<<<<<<<<<<<<<
 *             np.ndarray finres_pop = self.finres_pop
 *             double frp
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->resource_list);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_resource_list = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4669
 *             int [:, :] finres_terms=self.finres_terms
 *             np.ndarray resource_list=self.resource_list
 *             np.ndarray finres_pop = self.finres_pop             # <<<<<<<<<<<<<<
 *             double frp
 *             double [:] s, reagent, rate
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->finres_pop);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_finres_pop = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4672
 *             double frp
 *             double [:] s, reagent, rate
 *             double Omega=self.Omega             # <<<<<<<<<<<<<<
 *         s = x[S_index*M:(S_index+1)*M]
 * 
 */
  __pyx_t_6 = __pyx_v_self->__pyx_base.Omega;
  __pyx_v_Omega = __pyx_t_6;

  /* "pyross/inference.pyx":4673
 *             double [:] s, reagent, rate
 *             double Omega=self.Omega
 *         s = x[S_index*M:(S_index+1)*M]             # <<<<<<<<<<<<<<
 * 
 *         if self.constant_terms.size > 0:
 */
  __pyx_t_7.data = __pyx_v_x.data;
  __pyx_t_7.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
  __pyx_t_8 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_7,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_8,
    (__pyx_v_S_index * __pyx_v_M),
    ((__pyx_v_S_index + 1) * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4673, __pyx_L1_error)
}

__pyx_v_s = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "pyross/inference.pyx":4675
 *         s = x[S_index*M:(S_index+1)*M]
 * 
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4675, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4675, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {

    /* "pyross/inference.pyx":4676
 * 
 *         if self.constant_terms.size > 0:
 *             for i in range(constant_terms.shape[0]):             # <<<<<<<<<<<<<<
 *                 rate_index = constant_terms[i, 0]
 *                 class_index = constant_terms[i, 1]
 */
    __pyx_t_1 = (__pyx_v_constant_terms.shape[0]);
    __pyx_t_11 = __pyx_t_1;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pyross/inference.pyx":4677
 *         if self.constant_terms.size > 0:
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]             # <<<<<<<<<<<<<<
 *                 class_index = constant_terms[i, 1]
 *                 rate = parameters[rate_index]
 */
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_14 = 0;
      __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_constant_terms.data + __pyx_t_13 * __pyx_v_constant_terms.strides[0]) ) + __pyx_t_14 * __pyx_v_constant_terms.strides[1]) )));

      /* "pyross/inference.pyx":4678
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]
 *                 class_index = constant_terms[i, 1]             # <<<<<<<<<<<<<<
 *                 rate = parameters[rate_index]
 *                 for m in range(M):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = 1;
      __pyx_v_class_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_constant_terms.data + __pyx_t_15 * __pyx_v_constant_terms.strides[0]) ) + __pyx_t_16 * __pyx_v_constant_terms.strides[1]) )));

      /* "pyross/inference.pyx":4679
 *                 rate_index = constant_terms[i, 0]
 *                 class_index = constant_terms[i, 1]
 *                 rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *                 for m in range(M):
 *                     B[class_index, m, class_index, m] += rate[m]/Omega
 */
      __pyx_t_7.data = __pyx_v_parameters.data;
      __pyx_t_7.memview = __pyx_v_parameters.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
      {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 4679, __pyx_L1_error)
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_7.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
      __pyx_v_rate = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

      /* "pyross/inference.pyx":4680
 *                 class_index = constant_terms[i, 1]
 *                 rate = parameters[rate_index]
 *                 for m in range(M):             # <<<<<<<<<<<<<<
 *                     B[class_index, m, class_index, m] += rate[m]/Omega
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega
 */
      __pyx_t_17 = __pyx_v_M;
      __pyx_t_18 = __pyx_t_17;
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
        __pyx_v_m = __pyx_t_19;

        /* "pyross/inference.pyx":4681
 *                 rate = parameters[rate_index]
 *                 for m in range(M):
 *                     B[class_index, m, class_index, m] += rate[m]/Omega             # <<<<<<<<<<<<<<
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega
 * 
 */
        __pyx_t_20 = __pyx_v_m;
        __pyx_t_21 = __pyx_v_class_index;
        __pyx_t_22 = __pyx_v_m;
        __pyx_t_23 = __pyx_v_class_index;
        __pyx_t_24 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_21 * __pyx_v_B.strides[0]) ) + __pyx_t_22 * __pyx_v_B.strides[1]) ) + __pyx_t_23 * __pyx_v_B.strides[2]) ) + __pyx_t_24 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_20 * __pyx_v_rate.strides[0]) ))) / __pyx_v_Omega);

        /* "pyross/inference.pyx":4682
 *                 for m in range(M):
 *                     B[class_index, m, class_index, m] += rate[m]/Omega
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega             # <<<<<<<<<<<<<<
 * 
 *         for i in range(infection_terms.shape[0]):
 */
        __pyx_t_25 = __pyx_v_m;
        __pyx_t_26 = (__pyx_v_nClass - 1);
        __pyx_t_27 = __pyx_v_m;
        __pyx_t_28 = (__pyx_v_nClass - 1);
        __pyx_t_29 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_26 * __pyx_v_B.strides[0]) ) + __pyx_t_27 * __pyx_v_B.strides[1]) ) + __pyx_t_28 * __pyx_v_B.strides[2]) ) + __pyx_t_29 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_25 * __pyx_v_rate.strides[0]) ))) / __pyx_v_Omega);
      }
    }

    /* "pyross/inference.pyx":4675
 *         s = x[S_index*M:(S_index+1)*M]
 * 
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]
 */
  }

  /* "pyross/inference.pyx":4684
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega
 * 
 *         for i in range(infection_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_infection_terms.shape[0]);
  __pyx_t_11 = __pyx_t_1;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyross/inference.pyx":4685
 * 
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]             # <<<<<<<<<<<<<<
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 */
    __pyx_t_30 = __pyx_v_i;
    __pyx_t_31 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_30 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_31 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4686
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]             # <<<<<<<<<<<<<<
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_32 = __pyx_v_i;
    __pyx_t_33 = 1;
    __pyx_v_infective_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_32 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_33 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4687
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M):
 */
    __pyx_t_34 = __pyx_v_i;
    __pyx_t_35 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_34 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_35 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":4688
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 */
    __pyx_t_7.data = __pyx_v_parameters.data;
    __pyx_t_7.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 4688, __pyx_L1_error)
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_7.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":4689
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:
 */
    __pyx_t_17 = __pyx_v_M;
    __pyx_t_18 = __pyx_t_17;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_m = __pyx_t_19;

      /* "pyross/inference.pyx":4690
 *             rate = parameters[rate_index]
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 */
      __pyx_t_36 = __pyx_v_m;
      __pyx_t_37 = __pyx_v_i;
      __pyx_t_38 = __pyx_v_m;
      __pyx_t_39 = __pyx_v_m;
      __pyx_t_40 = __pyx_v_S_index;
      __pyx_t_41 = __pyx_v_m;
      __pyx_t_42 = __pyx_v_S_index;
      __pyx_t_43 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_40 * __pyx_v_B.strides[0]) ) + __pyx_t_41 * __pyx_v_B.strides[1]) ) + __pyx_t_42 * __pyx_v_B.strides[2]) ) + __pyx_t_43 * __pyx_v_B.strides[3]) )) += (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_36 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_37 * __pyx_v_l.strides[0]) ) + __pyx_t_38 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_39 * __pyx_v_s.strides[0]) ))));

      /* "pyross/inference.pyx":4691
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 */
      __pyx_t_10 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_10) {

        /* "pyross/inference.pyx":4692
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]
 */
        __pyx_t_44 = __pyx_v_m;
        __pyx_t_45 = __pyx_v_i;
        __pyx_t_46 = __pyx_v_m;
        __pyx_t_47 = __pyx_v_m;
        __pyx_t_48 = __pyx_v_S_index;
        __pyx_t_49 = __pyx_v_m;
        __pyx_t_50 = __pyx_v_product_index;
        __pyx_t_51 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_48 * __pyx_v_B.strides[0]) ) + __pyx_t_49 * __pyx_v_B.strides[1]) ) + __pyx_t_50 * __pyx_v_B.strides[2]) ) + __pyx_t_51 * __pyx_v_B.strides[3]) )) -= (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_44 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_45 * __pyx_v_l.strides[0]) ) + __pyx_t_46 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_47 * __pyx_v_s.strides[0]) ))));

        /* "pyross/inference.pyx":4693
 *                 if product_index>-1:
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]
 * 
 */
        __pyx_t_52 = __pyx_v_m;
        __pyx_t_53 = __pyx_v_i;
        __pyx_t_54 = __pyx_v_m;
        __pyx_t_55 = __pyx_v_m;
        __pyx_t_56 = __pyx_v_product_index;
        __pyx_t_57 = __pyx_v_m;
        __pyx_t_58 = __pyx_v_product_index;
        __pyx_t_59 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_56 * __pyx_v_B.strides[0]) ) + __pyx_t_57 * __pyx_v_B.strides[1]) ) + __pyx_t_58 * __pyx_v_B.strides[2]) ) + __pyx_t_59 * __pyx_v_B.strides[3]) )) += (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_52 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_53 * __pyx_v_l.strides[0]) ) + __pyx_t_54 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_55 * __pyx_v_s.strides[0]) ))));

        /* "pyross/inference.pyx":4694
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(linear_terms.shape[0]):
 */
        __pyx_t_60 = __pyx_v_m;
        __pyx_t_61 = __pyx_v_i;
        __pyx_t_62 = __pyx_v_m;
        __pyx_t_63 = __pyx_v_m;
        __pyx_t_64 = __pyx_v_product_index;
        __pyx_t_65 = __pyx_v_m;
        __pyx_t_66 = __pyx_v_S_index;
        __pyx_t_67 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_64 * __pyx_v_B.strides[0]) ) + __pyx_t_65 * __pyx_v_B.strides[1]) ) + __pyx_t_66 * __pyx_v_B.strides[2]) ) + __pyx_t_67 * __pyx_v_B.strides[3]) )) -= (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_60 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_61 * __pyx_v_l.strides[0]) ) + __pyx_t_62 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_63 * __pyx_v_s.strides[0]) ))));

        /* "pyross/inference.pyx":4691
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 */
      }
    }
  }

  /* "pyross/inference.pyx":4696
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]
 * 
 *         for i in range(linear_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_linear_terms.shape[0]);
  __pyx_t_11 = __pyx_t_1;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyross/inference.pyx":4697
 * 
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]             # <<<<<<<<<<<<<<
 *             reagent_index = linear_terms[i, 1]
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 */
    __pyx_t_68 = __pyx_v_i;
    __pyx_t_69 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_68 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_69 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":4698
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]             # <<<<<<<<<<<<<<
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 *             rate_index = linear_terms[i, 0]
 */
    __pyx_t_70 = __pyx_v_i;
    __pyx_t_71 = 1;
    __pyx_v_reagent_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_70 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_71 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":4699
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]             # <<<<<<<<<<<<<<
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_7.data = __pyx_v_x.data;
    __pyx_t_7.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    __pyx_t_8 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_7,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_8,
    (__pyx_v_reagent_index * __pyx_v_M),
    ((__pyx_v_reagent_index + 1) * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 4699, __pyx_L1_error)
}

__PYX_XDEC_MEMVIEW(&__pyx_v_reagent, 1);
    __pyx_v_reagent = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":4700
 *             reagent_index = linear_terms[i, 1]
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 *             rate_index = linear_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M): # only fill in the upper triangular form
 */
    __pyx_t_72 = __pyx_v_i;
    __pyx_t_73 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_72 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_73 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":4701
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 */
    __pyx_t_7.data = __pyx_v_parameters.data;
    __pyx_t_7.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 4701, __pyx_L1_error)
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_7.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":4702
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:
 */
    __pyx_t_17 = __pyx_v_M;
    __pyx_t_18 = __pyx_t_17;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_m = __pyx_t_19;

      /* "pyross/inference.pyx":4703
 *             rate = parameters[rate_index]
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 */
      __pyx_t_74 = __pyx_v_m;
      __pyx_t_75 = __pyx_v_m;
      __pyx_t_76 = __pyx_v_reagent_index;
      __pyx_t_77 = __pyx_v_m;
      __pyx_t_78 = __pyx_v_reagent_index;
      __pyx_t_79 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_76 * __pyx_v_B.strides[0]) ) + __pyx_t_77 * __pyx_v_B.strides[1]) ) + __pyx_t_78 * __pyx_v_B.strides[2]) ) + __pyx_t_79 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_74 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_75 * __pyx_v_reagent.strides[0]) ))));

      /* "pyross/inference.pyx":4704
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 */
      __pyx_t_10 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_10) {

        /* "pyross/inference.pyx":4705
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 */
        __pyx_t_80 = __pyx_v_m;
        __pyx_t_81 = __pyx_v_m;
        __pyx_t_82 = __pyx_v_product_index;
        __pyx_t_83 = __pyx_v_m;
        __pyx_t_84 = __pyx_v_product_index;
        __pyx_t_85 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_82 * __pyx_v_B.strides[0]) ) + __pyx_t_83 * __pyx_v_B.strides[1]) ) + __pyx_t_84 * __pyx_v_B.strides[2]) ) + __pyx_t_85 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_80 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_81 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":4706
 *                 if product_index>-1:
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 * 
 */
        __pyx_t_86 = __pyx_v_m;
        __pyx_t_87 = __pyx_v_m;
        __pyx_t_88 = __pyx_v_reagent_index;
        __pyx_t_89 = __pyx_v_m;
        __pyx_t_90 = __pyx_v_product_index;
        __pyx_t_91 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_88 * __pyx_v_B.strides[0]) ) + __pyx_t_89 * __pyx_v_B.strides[1]) ) + __pyx_t_90 * __pyx_v_B.strides[2]) ) + __pyx_t_91 * __pyx_v_B.strides[3]) )) += ((-(*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_86 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_87 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":4707
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 * 
 *         if finres_terms.size > 0:
 */
        __pyx_t_92 = __pyx_v_m;
        __pyx_t_93 = __pyx_v_m;
        __pyx_t_94 = __pyx_v_product_index;
        __pyx_t_95 = __pyx_v_m;
        __pyx_t_96 = __pyx_v_reagent_index;
        __pyx_t_97 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_94 * __pyx_v_B.strides[0]) ) + __pyx_t_95 * __pyx_v_B.strides[1]) ) + __pyx_t_96 * __pyx_v_B.strides[2]) ) + __pyx_t_97 * __pyx_v_B.strides[3]) )) += ((-(*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_92 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_93 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":4704
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 */
      }
    }
  }

  /* "pyross/inference.pyx":4709
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 * 
 *         if finres_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]
 */
  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_finres_terms, 2, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {

    /* "pyross/inference.pyx":4710
 * 
 *         if finres_terms.size > 0:
 *             for i in range(finres_terms.shape[0]):             # <<<<<<<<<<<<<<
 *                 resource_index = finres_terms[i, 0]
 *                 rate_index = resource_list[resource_index][0]
 */
    __pyx_t_1 = (__pyx_v_finres_terms.shape[0]);
    __pyx_t_11 = __pyx_t_1;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pyross/inference.pyx":4711
 *         if finres_terms.size > 0:
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]             # <<<<<<<<<<<<<<
 *                 rate_index = resource_list[resource_index][0]
 *                 priority_index = finres_terms[i, 1]
 */
      __pyx_t_98 = __pyx_v_i;
      __pyx_t_99 = 0;
      __pyx_v_resource_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_98 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_99 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4712
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]
 *                 rate_index = resource_list[resource_index][0]             # <<<<<<<<<<<<<<
 *                 priority_index = finres_terms[i, 1]
 *                 probability_index = finres_terms[i, 2]
 */
      __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_resource_list), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4712, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_rate_index = __pyx_t_17;

      /* "pyross/inference.pyx":4713
 *                 resource_index = finres_terms[i, 0]
 *                 rate_index = resource_list[resource_index][0]
 *                 priority_index = finres_terms[i, 1]             # <<<<<<<<<<<<<<
 *                 probability_index = finres_terms[i, 2]
 *                 class_index = finres_terms[i, 3]
 */
      __pyx_t_100 = __pyx_v_i;
      __pyx_t_101 = 1;
      __pyx_v_priority_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_100 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_101 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4714
 *                 rate_index = resource_list[resource_index][0]
 *                 priority_index = finres_terms[i, 1]
 *                 probability_index = finres_terms[i, 2]             # <<<<<<<<<<<<<<
 *                 class_index = finres_terms[i, 3]
 *                 reagent_index = self.finres_terms[i, 4]
 */
      __pyx_t_102 = __pyx_v_i;
      __pyx_t_103 = 2;
      __pyx_v_probability_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_102 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_103 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4715
 *                 priority_index = finres_terms[i, 1]
 *                 probability_index = finres_terms[i, 2]
 *                 class_index = finres_terms[i, 3]             # <<<<<<<<<<<<<<
 *                 reagent_index = self.finres_terms[i, 4]
 *                 product_index = self.finres_terms[i, 5]
 */
      __pyx_t_104 = __pyx_v_i;
      __pyx_t_105 = 3;
      __pyx_v_class_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_finres_terms.data + __pyx_t_104 * __pyx_v_finres_terms.strides[0]) ) + __pyx_t_105 * __pyx_v_finres_terms.strides[1]) )));

      /* "pyross/inference.pyx":4716
 *                 probability_index = finres_terms[i, 2]
 *                 class_index = finres_terms[i, 3]
 *                 reagent_index = self.finres_terms[i, 4]             # <<<<<<<<<<<<<<
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):
 */
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_4);
      __Pyx_GIVEREF(__pyx_int_4);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_4);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->finres_terms), __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_reagent_index = __pyx_t_17;

      /* "pyross/inference.pyx":4717
 *                 class_index = finres_terms[i, 3]
 *                 reagent_index = self.finres_terms[i, 4]
 *                 product_index = self.finres_terms[i, 5]             # <<<<<<<<<<<<<<
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:
 */
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_5);
      __Pyx_GIVEREF(__pyx_int_5);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_5);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->finres_terms), __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4717, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_product_index = __pyx_t_17;

      /* "pyross/inference.pyx":4718
 *                 reagent_index = self.finres_terms[i, 4]
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):             # <<<<<<<<<<<<<<
 *                     if np.size(finres_pop[resource_index]) == 1:
 *                         frp = finres_pop[resource_index]
 */
      __pyx_t_17 = __pyx_v_M;
      __pyx_t_18 = __pyx_t_17;
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
        __pyx_v_m = __pyx_t_19;

        /* "pyross/inference.pyx":4719
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:             # <<<<<<<<<<<<<<
 *                         frp = finres_pop[resource_index]
 *                     else:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_106 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_size); if (unlikely(!__pyx_t_106)) __PYX_ERR(0, 4719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_106);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_107 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_106))) {
          __pyx_t_107 = PyMethod_GET_SELF(__pyx_t_106);
          if (likely(__pyx_t_107)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_106);
            __Pyx_INCREF(__pyx_t_107);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_106, function);
          }
        }
        __pyx_t_2 = (__pyx_t_107) ? __Pyx_PyObject_Call2Args(__pyx_t_106, __pyx_t_107, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_106, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_107); __pyx_t_107 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_106); __pyx_t_106 = 0;
        __pyx_t_106 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_106)) __PYX_ERR(0, 4719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_106);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_106); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4719, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_106); __pyx_t_106 = 0;
        if (__pyx_t_10) {

          /* "pyross/inference.pyx":4720
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:
 *                         frp = finres_pop[resource_index]             # <<<<<<<<<<<<<<
 *                     else:
 *                         frp = finres_pop[resource_index][m]
 */
          __pyx_t_106 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_106)) __PYX_ERR(0, 4720, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_106);
          __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_106); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4720, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_106); __pyx_t_106 = 0;
          __pyx_v_frp = __pyx_t_6;

          /* "pyross/inference.pyx":4719
 *                 product_index = self.finres_terms[i, 5]
 *                 for m in range(M):
 *                     if np.size(finres_pop[resource_index]) == 1:             # <<<<<<<<<<<<<<
 *                         frp = finres_pop[resource_index]
 *                     else:
 */
          goto __pyx_L23;
        }

        /* "pyross/inference.pyx":4722
 *                         frp = finres_pop[resource_index]
 *                     else:
 *                         frp = finres_pop[resource_index][m]             # <<<<<<<<<<<<<<
 *                     term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                            * parameters[probability_index, m] * x[class_index*M+m] / (frp * self.Omega)
 */
        /*else*/ {
          __pyx_t_106 = __Pyx_GetItemInt(((PyObject *)__pyx_v_finres_pop), __pyx_v_resource_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_106)) __PYX_ERR(0, 4722, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_106);
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_106, __pyx_v_m, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4722, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_106); __pyx_t_106 = 0;
          __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_frp = __pyx_t_6;
        }
        __pyx_L23:;

        /* "pyross/inference.pyx":4723
 *                     else:
 *                         frp = finres_pop[resource_index][m]
 *                     term = parameters[rate_index, m] * parameters[priority_index, m] \             # <<<<<<<<<<<<<<
 *                            * parameters[probability_index, m] * x[class_index*M+m] / (frp * self.Omega)
 *                     if reagent_index>-1:
 */
        __pyx_t_108 = __pyx_v_rate_index;
        __pyx_t_109 = __pyx_v_m;
        __pyx_t_110 = __pyx_v_priority_index;
        __pyx_t_111 = __pyx_v_m;

        /* "pyross/inference.pyx":4724
 *                         frp = finres_pop[resource_index][m]
 *                     term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                            * parameters[probability_index, m] * x[class_index*M+m] / (frp * self.Omega)             # <<<<<<<<<<<<<<
 *                     if reagent_index>-1:
 *                         B[reagent_index, m, reagent_index, m] += term
 */
        __pyx_t_112 = __pyx_v_probability_index;
        __pyx_t_113 = __pyx_v_m;
        __pyx_t_114 = ((__pyx_v_class_index * __pyx_v_M) + __pyx_v_m);
        __pyx_t_2 = PyFloat_FromDouble((((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_108 * __pyx_v_parameters.strides[0]) ) + __pyx_t_109 * __pyx_v_parameters.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_110 * __pyx_v_parameters.strides[0]) ) + __pyx_t_111 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_112 * __pyx_v_parameters.strides[0]) ) + __pyx_t_113 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_114 * __pyx_v_x.strides[0]) )))) / (__pyx_v_frp * __pyx_v_self->__pyx_base.Omega))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4724, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_term, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "pyross/inference.pyx":4725
 *                     term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                            * parameters[probability_index, m] * x[class_index*M+m] / (frp * self.Omega)
 *                     if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                         B[reagent_index, m, reagent_index, m] += term
 *                         if product_index>-1:
 */
        __pyx_t_10 = ((__pyx_v_reagent_index > -1L) != 0);
        if (__pyx_t_10) {

          /* "pyross/inference.pyx":4726
 *                            * parameters[probability_index, m] * x[class_index*M+m] / (frp * self.Omega)
 *                     if reagent_index>-1:
 *                         B[reagent_index, m, reagent_index, m] += term             # <<<<<<<<<<<<<<
 *                         if product_index>-1:
 *                             B[reagent_index, m, product_index, m] -= term
 */
          __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_term); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4726, __pyx_L1_error)
          __pyx_t_115 = __pyx_v_reagent_index;
          __pyx_t_116 = __pyx_v_m;
          __pyx_t_117 = __pyx_v_reagent_index;
          __pyx_t_118 = __pyx_v_m;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_115 * __pyx_v_B.strides[0]) ) + __pyx_t_116 * __pyx_v_B.strides[1]) ) + __pyx_t_117 * __pyx_v_B.strides[2]) ) + __pyx_t_118 * __pyx_v_B.strides[3]) )) += __pyx_t_6;

          /* "pyross/inference.pyx":4727
 *                     if reagent_index>-1:
 *                         B[reagent_index, m, reagent_index, m] += term
 *                         if product_index>-1:             # <<<<<<<<<<<<<<
 *                             B[reagent_index, m, product_index, m] -= term
 *                             B[product_index, m, reagent_index, m] -= term
 */
          __pyx_t_10 = ((__pyx_v_product_index > -1L) != 0);
          if (__pyx_t_10) {

            /* "pyross/inference.pyx":4728
 *                         B[reagent_index, m, reagent_index, m] += term
 *                         if product_index>-1:
 *                             B[reagent_index, m, product_index, m] -= term             # <<<<<<<<<<<<<<
 *                             B[product_index, m, reagent_index, m] -= term
 *                     if product_index>-1:
 */
            __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_term); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4728, __pyx_L1_error)
            __pyx_t_119 = __pyx_v_reagent_index;
            __pyx_t_120 = __pyx_v_m;
            __pyx_t_121 = __pyx_v_product_index;
            __pyx_t_122 = __pyx_v_m;
            *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_119 * __pyx_v_B.strides[0]) ) + __pyx_t_120 * __pyx_v_B.strides[1]) ) + __pyx_t_121 * __pyx_v_B.strides[2]) ) + __pyx_t_122 * __pyx_v_B.strides[3]) )) -= __pyx_t_6;

            /* "pyross/inference.pyx":4729
 *                         if product_index>-1:
 *                             B[reagent_index, m, product_index, m] -= term
 *                             B[product_index, m, reagent_index, m] -= term             # <<<<<<<<<<<<<<
 *                     if product_index>-1:
 *                         B[product_index, m, product_index, m] += term
 */
            __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_term); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4729, __pyx_L1_error)
            __pyx_t_123 = __pyx_v_product_index;
            __pyx_t_124 = __pyx_v_m;
            __pyx_t_125 = __pyx_v_reagent_index;
            __pyx_t_126 = __pyx_v_m;
            *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_123 * __pyx_v_B.strides[0]) ) + __pyx_t_124 * __pyx_v_B.strides[1]) ) + __pyx_t_125 * __pyx_v_B.strides[2]) ) + __pyx_t_126 * __pyx_v_B.strides[3]) )) -= __pyx_t_6;

            /* "pyross/inference.pyx":4727
 *                     if reagent_index>-1:
 *                         B[reagent_index, m, reagent_index, m] += term
 *                         if product_index>-1:             # <<<<<<<<<<<<<<
 *                             B[reagent_index, m, product_index, m] -= term
 *                             B[product_index, m, reagent_index, m] -= term
 */
          }

          /* "pyross/inference.pyx":4725
 *                     term = parameters[rate_index, m] * parameters[priority_index, m] \
 *                            * parameters[probability_index, m] * x[class_index*M+m] / (frp * self.Omega)
 *                     if reagent_index>-1:             # <<<<<<<<<<<<<<
 *                         B[reagent_index, m, reagent_index, m] += term
 *                         if product_index>-1:
 */
        }

        /* "pyross/inference.pyx":4730
 *                             B[reagent_index, m, product_index, m] -= term
 *                             B[product_index, m, reagent_index, m] -= term
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         B[product_index, m, product_index, m] += term
 * 
 */
        __pyx_t_10 = ((__pyx_v_product_index > -1L) != 0);
        if (__pyx_t_10) {

          /* "pyross/inference.pyx":4731
 *                             B[product_index, m, reagent_index, m] -= term
 *                     if product_index>-1:
 *                         B[product_index, m, product_index, m] += term             # <<<<<<<<<<<<<<
 * 
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]
 */
          __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_term); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4731, __pyx_L1_error)
          __pyx_t_127 = __pyx_v_product_index;
          __pyx_t_128 = __pyx_v_m;
          __pyx_t_129 = __pyx_v_product_index;
          __pyx_t_130 = __pyx_v_m;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_127 * __pyx_v_B.strides[0]) ) + __pyx_t_128 * __pyx_v_B.strides[1]) ) + __pyx_t_129 * __pyx_v_B.strides[2]) ) + __pyx_t_130 * __pyx_v_B.strides[3]) )) += __pyx_t_6;

          /* "pyross/inference.pyx":4730
 *                             B[reagent_index, m, product_index, m] -= term
 *                             B[product_index, m, reagent_index, m] -= term
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         B[product_index, m, product_index, m] += term
 * 
 */
        }
      }
    }

    /* "pyross/inference.pyx":4709
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 * 
 *         if finres_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(finres_terms.shape[0]):
 *                 resource_index = finres_terms[i, 0]
 */
  }

  /* "pyross/inference.pyx":4733
 *                         B[product_index, m, product_index, m] += term
 * 
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __pyx_t_106 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.B), __pyx_n_s_reshape); if (unlikely(!__pyx_t_106)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_106);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_107 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_107)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_107);
  __pyx_t_131 = PyTuple_New(2); if (unlikely(!__pyx_t_131)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_131);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_131, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_107);
  PyTuple_SET_ITEM(__pyx_t_131, 1, __pyx_t_107);
  __pyx_t_9 = 0;
  __pyx_t_107 = 0;
  __pyx_t_107 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_106))) {
    __pyx_t_107 = PyMethod_GET_SELF(__pyx_t_106);
    if (likely(__pyx_t_107)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_106);
      __Pyx_INCREF(__pyx_t_107);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_106, function);
    }
  }
  __pyx_t_2 = (__pyx_t_107) ? __Pyx_PyObject_Call2Args(__pyx_t_106, __pyx_t_107, __pyx_t_131) : __Pyx_PyObject_CallOneArg(__pyx_t_106, __pyx_t_131);
  __Pyx_XDECREF(__pyx_t_107); __pyx_t_107 = 0;
  __Pyx_DECREF(__pyx_t_131); __pyx_t_131 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_106); __pyx_t_106 = 0;
  __pyx_t_106 = PyTuple_New(2); if (unlikely(!__pyx_t_106)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_106);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_106, 0, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_106, 1, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __pyx_t_131 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_106); if (unlikely(!__pyx_t_131)) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_131);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_106); __pyx_t_106 = 0;
  if (!(likely(((__pyx_t_131) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_131, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4733, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_131);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __pyx_v_self->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_131);
  __pyx_t_131 = 0;

  /* "pyross/inference.pyx":4657
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, nClass=self.nClass, class_index
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_106);
  __Pyx_XDECREF(__pyx_t_107);
  __Pyx_XDECREF(__pyx_t_131);
  __Pyx_AddTraceback("pyross.inference.Spp.noise_correlation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_B, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_parameters, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_constant_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_linear_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_infection_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_finres_terms, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_resource_list);
  __Pyx_XDECREF((PyObject *)__pyx_v_finres_pop);
  __PYX_XDEC_MEMVIEW(&__pyx_v_s, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_reagent, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
  __Pyx_XDECREF(__pyx_v_term);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4373
 * 
 *     cdef:
 *         readonly np.ndarray constant_terms, linear_terms, infection_terms, finres_terms, resource_list             # <<<<<<<<<<<<<<
 *         readonly np.ndarray model_parameters
 *         readonly np.ndarray model_parameters_length
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_14constant_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_14constant_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_14constant_terms___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_14constant_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->constant_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->constant_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_12linear_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_12linear_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_12linear_terms___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_12linear_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->linear_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->linear_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_15infection_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_15infection_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_15infection_terms___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_15infection_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->infection_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->infection_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_12finres_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_12finres_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_12finres_terms___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_12finres_terms___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->finres_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->finres_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_13resource_list_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_13resource_list_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_13resource_list___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_13resource_list___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->resource_list));
  __pyx_r = ((PyObject *)__pyx_v_self->resource_list);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4374
 *     cdef:
 *         readonly np.ndarray constant_terms, linear_terms, infection_terms, finres_terms, resource_list
 *         readonly np.ndarray model_parameters             # <<<<<<<<<<<<<<
 *         readonly np.ndarray model_parameters_length
 *         readonly np.ndarray finres_pop
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_16model_parameters_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_16model_parameters_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_16model_parameters___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_16model_parameters___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->model_parameters));
  __pyx_r = ((PyObject *)__pyx_v_self->model_parameters);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4375
 *         readonly np.ndarray constant_terms, linear_terms, infection_terms, finres_terms, resource_list
 *         readonly np.ndarray model_parameters
 *         readonly np.ndarray model_parameters_length             # <<<<<<<<<<<<<<
 *         readonly np.ndarray finres_pop
 *         readonly pyross.deterministic.Spp det_model
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_23model_parameters_length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_23model_parameters_length_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_23model_parameters_length___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_23model_parameters_length___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->model_parameters_length));
  __pyx_r = ((PyObject *)__pyx_v_self->model_parameters_length);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4376
 *         readonly np.ndarray model_parameters
 *         readonly np.ndarray model_parameters_length
 *         readonly np.ndarray finres_pop             # <<<<<<<<<<<<<<
 *         readonly pyross.deterministic.Spp det_model
 *         readonly dict model_spec
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_10finres_pop_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_10finres_pop_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_10finres_pop___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_10finres_pop___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->finres_pop));
  __pyx_r = ((PyObject *)__pyx_v_self->finres_pop);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4377
 *         readonly np.ndarray model_parameters_length
 *         readonly np.ndarray finres_pop
 *         readonly pyross.deterministic.Spp det_model             # <<<<<<<<<<<<<<
 *         readonly dict model_spec
 *         readonly dict param_dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_9det_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_9det_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_9det_model___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_9det_model___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_r = ((PyObject *)__pyx_v_self->det_model);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4378
 *         readonly np.ndarray finres_pop
 *         readonly pyross.deterministic.Spp det_model
 *         readonly dict model_spec             # <<<<<<<<<<<<<<
 *         readonly dict param_dict
 *         readonly list model_param_keys
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_10model_spec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_10model_spec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_10model_spec___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_10model_spec___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->model_spec);
  __pyx_r = __pyx_v_self->model_spec;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4379
 *         readonly pyross.deterministic.Spp det_model
 *         readonly dict model_spec
 *         readonly dict param_dict             # <<<<<<<<<<<<<<
 *         readonly list model_param_keys
 *         readonly object parameter_mapping
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_10param_dict_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_10param_dict_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_10param_dict___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_10param_dict___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->param_dict);
  __pyx_r = __pyx_v_self->param_dict;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4380
 *         readonly dict model_spec
 *         readonly dict param_dict
 *         readonly list model_param_keys             # <<<<<<<<<<<<<<
 *         readonly object parameter_mapping
 *         readonly object time_dep_param_mapping
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_16model_param_keys_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_16model_param_keys_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_16model_param_keys___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_16model_param_keys___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->model_param_keys);
  __pyx_r = __pyx_v_self->model_param_keys;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4381
 *         readonly dict param_dict
 *         readonly list model_param_keys
 *         readonly object parameter_mapping             # <<<<<<<<<<<<<<
 *         readonly object time_dep_param_mapping
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_17parameter_mapping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_17parameter_mapping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_17parameter_mapping___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_17parameter_mapping___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->parameter_mapping);
  __pyx_r = __pyx_v_self->parameter_mapping;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4382
 *         readonly list model_param_keys
 *         readonly object parameter_mapping
 *         readonly object time_dep_param_mapping             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_22time_dep_param_mapping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_22time_dep_param_mapping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_22time_dep_param_mapping___get__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_22time_dep_param_mapping___get__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->time_dep_param_mapping);
  __pyx_r = __pyx_v_self->time_dep_param_mapping;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_12__reduce_cython__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_12__reduce_cython__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(48); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->constant_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->constant_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 14, ((PyObject *)__pyx_v_self->constant_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_v_self->__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 17, ((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->finres_pop));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->finres_pop));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->finres_pop));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->finres_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->finres_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->finres_terms));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 26, ((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 27, ((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 28, ((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->infection_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->infection_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 29, ((PyObject *)__pyx_v_self->infection_terms));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->linear_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->linear_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 30, ((PyObject *)__pyx_v_self->linear_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_INCREF(__pyx_v_self->model_param_keys);
  __Pyx_GIVEREF(__pyx_v_self->model_param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_v_self->model_param_keys);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->model_parameters));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->model_parameters));
  PyTuple_SET_ITEM(__pyx_t_10, 33, ((PyObject *)__pyx_v_self->model_parameters));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->model_parameters_length));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->model_parameters_length));
  PyTuple_SET_ITEM(__pyx_t_10, 34, ((PyObject *)__pyx_v_self->model_parameters_length));
  __Pyx_INCREF(__pyx_v_self->model_spec);
  __Pyx_GIVEREF(__pyx_v_self->model_spec);
  PyTuple_SET_ITEM(__pyx_t_10, 35, __pyx_v_self->model_spec);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 36, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->param_dict);
  __Pyx_GIVEREF(__pyx_v_self->param_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 37, __pyx_v_self->param_dict);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 38, __pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 39, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_self->parameter_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 40, __pyx_v_self->parameter_mapping);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->resource_list));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->resource_list));
  PyTuple_SET_ITEM(__pyx_t_10, 41, ((PyObject *)__pyx_v_self->resource_list));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 42, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 43, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 44, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 45, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_self->time_dep_param_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 46, __pyx_v_self->time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 47, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->constant_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.contactMatrix != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.dsigmadt) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.fi) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->finres_pop) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->finres_terms) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices1) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices2) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.fsa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.gIa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.gIs) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->infection_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->linear_terms) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->model_param_keys != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->model_parameters) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->model_parameters_length) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->model_spec != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->param_dict != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->parameter_mapping != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->resource_list) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.rows) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->time_dep_param_mapping != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_Spp); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_6898761);
    __Pyx_GIVEREF(__pyx_int_6898761);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_6898761);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, None), state
 *     else:
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Spp__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_Spp); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_6898761);
    __Pyx_GIVEREF(__pyx_int_6898761);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_6898761);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.Spp.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Spp__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3Spp_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_3Spp_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_3Spp_14__setstate_cython__(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_3Spp_14__setstate_cython__(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Spp__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_Spp__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Spp, (type(self), 0x0694449, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Spp__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.Spp.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4812
 *         readonly object testRate
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_4SppQ_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_4SppQ_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_model_spec = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_testRate = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  PyObject *__pyx_v_parameter_mapping = 0;
  PyObject *__pyx_v_time_dep_param_mapping = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_model_spec,&__pyx_n_s_parameters,&__pyx_n_s_testRate,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,&__pyx_n_s_parameter_mapping,&__pyx_n_s_time_dep_param_mapping,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)__pyx_int_1);
    values[6] = ((PyObject *)__pyx_int_4);
    values[7] = ((PyObject *)__pyx_n_u_LSODA);
    values[8] = ((PyObject *)__pyx_n_u_LSODA);
    values[9] = ((PyObject *)__pyx_float_1eneg_3);
    values[10] = ((PyObject *)__pyx_float_1eneg_3);

    /* "pyross/inference.pyx":4813
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):             # <<<<<<<<<<<<<<
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 */
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model_spec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 1); __PYX_ERR(0, 4812, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_testRate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 2); __PYX_ERR(0, 4812, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 3); __PYX_ERR(0, 4812, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 4); __PYX_ERR(0, 4812, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameter_mapping);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_time_dep_param_mapping);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 4812, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_model_spec = values[0];
    __pyx_v_parameters = values[1];
    __pyx_v_testRate = values[2];
    __pyx_v_M = values[3];
    __pyx_v_fi = values[4];
    __pyx_v_Omega = values[5];
    __pyx_v_steps = values[6];
    __pyx_v_det_method = values[7];
    __pyx_v_lyapunov_method = values[8];
    __pyx_v_rtol_det = values[9];
    __pyx_v_rtol_lyapunov = values[10];
    __pyx_v_parameter_mapping = values[11];
    __pyx_v_time_dep_param_mapping = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4812, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SppQ.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ___init__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self), __pyx_v_model_spec, __pyx_v_parameters, __pyx_v_testRate, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov, __pyx_v_parameter_mapping, __pyx_v_time_dep_param_mapping);

  /* "pyross/inference.pyx":4812
 *         readonly object testRate
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_4SppQ___init__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_parameters, PyObject *__pyx_v_testRate, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyross/inference.pyx":4814
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.full_model_spec = pyross.utils.build_SppQ_model_spec(model_spec)
 */
  __pyx_t_2 = (__pyx_v_parameter_mapping != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_time_dep_param_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pyross/inference.pyx":4815
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')             # <<<<<<<<<<<<<<
 *         self.full_model_spec = pyross.utils.build_SppQ_model_spec(model_spec)
 *         self.input_time_dep_param_mapping = time_dep_param_mapping
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 4815, __pyx_L1_error)

    /* "pyross/inference.pyx":4814
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.full_model_spec = pyross.utils.build_SppQ_model_spec(model_spec)
 */
  }

  /* "pyross/inference.pyx":4816
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.full_model_spec = pyross.utils.build_SppQ_model_spec(model_spec)             # <<<<<<<<<<<<<<
 *         self.input_time_dep_param_mapping = time_dep_param_mapping
 *         self.input_param_mapping = parameter_mapping
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_build_SppQ_model_spec); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_model_spec) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_model_spec);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 4816, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->full_model_spec);
  __Pyx_DECREF(__pyx_v_self->full_model_spec);
  __pyx_v_self->full_model_spec = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4817
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.full_model_spec = pyross.utils.build_SppQ_model_spec(model_spec)
 *         self.input_time_dep_param_mapping = time_dep_param_mapping             # <<<<<<<<<<<<<<
 *         self.input_param_mapping = parameter_mapping
 *         self.testRate = testRate
 */
  __Pyx_INCREF(__pyx_v_time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_time_dep_param_mapping);
  __Pyx_GOTREF(__pyx_v_self->input_time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v_self->input_time_dep_param_mapping);
  __pyx_v_self->input_time_dep_param_mapping = __pyx_v_time_dep_param_mapping;

  /* "pyross/inference.pyx":4818
 *         self.full_model_spec = pyross.utils.build_SppQ_model_spec(model_spec)
 *         self.input_time_dep_param_mapping = time_dep_param_mapping
 *         self.input_param_mapping = parameter_mapping             # <<<<<<<<<<<<<<
 *         self.testRate = testRate
 *         super().__init__(self.full_model_spec, parameters, M, fi, Omega, steps,
 */
  __Pyx_INCREF(__pyx_v_parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_parameter_mapping);
  __Pyx_GOTREF(__pyx_v_self->input_param_mapping);
  __Pyx_DECREF(__pyx_v_self->input_param_mapping);
  __pyx_v_self->input_param_mapping = __pyx_v_parameter_mapping;

  /* "pyross/inference.pyx":4819
 *         self.input_time_dep_param_mapping = time_dep_param_mapping
 *         self.input_param_mapping = parameter_mapping
 *         self.testRate = testRate             # <<<<<<<<<<<<<<
 *         super().__init__(self.full_model_spec, parameters, M, fi, Omega, steps,
 *                                     det_method, lyapunov_method, rtol_det, rtol_lyapunov, parameter_mapping=None, time_dep_param_mapping=self.full_time_dep_param_mapping)
 */
  __Pyx_INCREF(__pyx_v_testRate);
  __Pyx_GIVEREF(__pyx_v_testRate);
  __Pyx_GOTREF(__pyx_v_self->testRate);
  __Pyx_DECREF(__pyx_v_self->testRate);
  __pyx_v_self->testRate = __pyx_v_testRate;

  /* "pyross/inference.pyx":4820
 *         self.input_param_mapping = parameter_mapping
 *         self.testRate = testRate
 *         super().__init__(self.full_model_spec, parameters, M, fi, Omega, steps,             # <<<<<<<<<<<<<<
 *                                     det_method, lyapunov_method, rtol_det, rtol_lyapunov, parameter_mapping=None, time_dep_param_mapping=self.full_time_dep_param_mapping)
 * 
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SppQ));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SppQ));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SppQ));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyross/inference.pyx":4821
 *         self.testRate = testRate
 *         super().__init__(self.full_model_spec, parameters, M, fi, Omega, steps,
 *                                     det_method, lyapunov_method, rtol_det, rtol_lyapunov, parameter_mapping=None, time_dep_param_mapping=self.full_time_dep_param_mapping)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = PyTuple_New(10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->full_model_spec);
  __Pyx_GIVEREF(__pyx_v_self->full_model_spec);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->full_model_spec);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_parameters);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_GIVEREF(__pyx_v_M);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_M);
  __Pyx_INCREF(__pyx_v_fi);
  __Pyx_GIVEREF(__pyx_v_fi);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_fi);
  __Pyx_INCREF(__pyx_v_Omega);
  __Pyx_GIVEREF(__pyx_v_Omega);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_Omega);
  __Pyx_INCREF(__pyx_v_steps);
  __Pyx_GIVEREF(__pyx_v_steps);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_steps);
  __Pyx_INCREF(__pyx_v_det_method);
  __Pyx_GIVEREF(__pyx_v_det_method);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_det_method);
  __Pyx_INCREF(__pyx_v_lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_lyapunov_method);
  __Pyx_INCREF(__pyx_v_rtol_det);
  __Pyx_GIVEREF(__pyx_v_rtol_det);
  PyTuple_SET_ITEM(__pyx_t_5, 8, __pyx_v_rtol_det);
  __Pyx_INCREF(__pyx_v_rtol_lyapunov);
  __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
  PyTuple_SET_ITEM(__pyx_t_5, 9, __pyx_v_rtol_lyapunov);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_parameter_mapping, Py_None) < 0) __PYX_ERR(0, 4821, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_full_time_dep_param_mapping); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_time_dep_param_mapping, __pyx_t_7) < 0) __PYX_ERR(0, 4821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":4820
 *         self.input_param_mapping = parameter_mapping
 *         self.testRate = testRate
 *         super().__init__(self.full_model_spec, parameters, M, fi, Omega, steps,             # <<<<<<<<<<<<<<
 *                                     det_method, lyapunov_method, rtol_det, rtol_lyapunov, parameter_mapping=None, time_dep_param_mapping=self.full_time_dep_param_mapping)
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":4812
 *         readonly object testRate
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SppQ.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4824
 * 
 * 
 *     cpdef full_time_dep_param_mapping(self, input_parameters, t):             # <<<<<<<<<<<<<<
 *         cdef dict output_param_dict
 *         if self.input_time_dep_param_mapping is not None:
 */

static PyObject *__pyx_pw_6pyross_9inference_4SppQ_3full_time_dep_param_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pyross_9inference_4SppQ_full_time_dep_param_mapping(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_input_parameters, PyObject *__pyx_v_t, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_output_param_dict = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("full_time_dep_param_mapping", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_full_time_dep_param_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4824, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pyross_9inference_4SppQ_3full_time_dep_param_mapping)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_input_parameters, __pyx_v_t};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4824, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_input_parameters, __pyx_v_t};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4824, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4824, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_input_parameters);
          __Pyx_GIVEREF(__pyx_v_input_parameters);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_input_parameters);
          __Pyx_INCREF(__pyx_v_t);
          __Pyx_GIVEREF(__pyx_v_t);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_t);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4824, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pyross/inference.pyx":4826
 *     cpdef full_time_dep_param_mapping(self, input_parameters, t):
 *         cdef dict output_param_dict
 *         if self.input_time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             output_param_dict = self.input_time_dep_param_mapping(input_parameters, t).copy()
 *         elif self.input_param_mapping is not None:
 */
  __pyx_t_7 = (__pyx_v_self->input_time_dep_param_mapping != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":4827
 *         cdef dict output_param_dict
 *         if self.input_time_dep_param_mapping is not None:
 *             output_param_dict = self.input_time_dep_param_mapping(input_parameters, t).copy()             # <<<<<<<<<<<<<<
 *         elif self.input_param_mapping is not None:
 *             output_param_dict = self.input_param_mapping(input_parameters).copy()
 */
    __Pyx_INCREF(__pyx_v_self->input_time_dep_param_mapping);
    __pyx_t_3 = __pyx_v_self->input_time_dep_param_mapping; __pyx_t_6 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_input_parameters, __pyx_v_t};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4827, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_input_parameters, __pyx_v_t};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4827, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_input_parameters);
      __Pyx_GIVEREF(__pyx_v_input_parameters);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_input_parameters);
      __Pyx_INCREF(__pyx_v_t);
      __Pyx_GIVEREF(__pyx_v_t);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_t);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 4827, __pyx_L1_error)
    __pyx_v_output_param_dict = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4826
 *     cpdef full_time_dep_param_mapping(self, input_parameters, t):
 *         cdef dict output_param_dict
 *         if self.input_time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             output_param_dict = self.input_time_dep_param_mapping(input_parameters, t).copy()
 *         elif self.input_param_mapping is not None:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":4828
 *         if self.input_time_dep_param_mapping is not None:
 *             output_param_dict = self.input_time_dep_param_mapping(input_parameters, t).copy()
 *         elif self.input_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             output_param_dict = self.input_param_mapping(input_parameters).copy()
 *         else:
 */
  __pyx_t_8 = (__pyx_v_self->input_param_mapping != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":4829
 *             output_param_dict = self.input_time_dep_param_mapping(input_parameters, t).copy()
 *         elif self.input_param_mapping is not None:
 *             output_param_dict = self.input_param_mapping(input_parameters).copy()             # <<<<<<<<<<<<<<
 *         else:
 *             output_param_dict = input_parameters.copy()
 */
    __Pyx_INCREF(__pyx_v_self->input_param_mapping);
    __pyx_t_2 = __pyx_v_self->input_param_mapping; __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_input_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_input_parameters);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 4829, __pyx_L1_error)
    __pyx_v_output_param_dict = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4828
 *         if self.input_time_dep_param_mapping is not None:
 *             output_param_dict = self.input_time_dep_param_mapping(input_parameters, t).copy()
 *         elif self.input_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             output_param_dict = self.input_param_mapping(input_parameters).copy()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":4831
 *             output_param_dict = self.input_param_mapping(input_parameters).copy()
 *         else:
 *             output_param_dict = input_parameters.copy()             # <<<<<<<<<<<<<<
 *         if self.testRate is not None:
 *             output_param_dict['tau'] = self.testRate(t)
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_input_parameters, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 4831, __pyx_L1_error)
    __pyx_v_output_param_dict = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":4832
 *         else:
 *             output_param_dict = input_parameters.copy()
 *         if self.testRate is not None:             # <<<<<<<<<<<<<<
 *             output_param_dict['tau'] = self.testRate(t)
 *         else:
 */
  __pyx_t_7 = (__pyx_v_self->testRate != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "pyross/inference.pyx":4833
 *             output_param_dict = input_parameters.copy()
 *         if self.testRate is not None:
 *             output_param_dict['tau'] = self.testRate(t)             # <<<<<<<<<<<<<<
 *         else:
 *             output_param_dict['tau'] = 0
 */
    __Pyx_INCREF(__pyx_v_self->testRate);
    __pyx_t_2 = __pyx_v_self->testRate; __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_output_param_dict == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 4833, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_output_param_dict, __pyx_n_u_tau, __pyx_t_1) < 0)) __PYX_ERR(0, 4833, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4832
 *         else:
 *             output_param_dict = input_parameters.copy()
 *         if self.testRate is not None:             # <<<<<<<<<<<<<<
 *             output_param_dict['tau'] = self.testRate(t)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":4835
 *             output_param_dict['tau'] = self.testRate(t)
 *         else:
 *             output_param_dict['tau'] = 0             # <<<<<<<<<<<<<<
 *         return output_param_dict
 * 
 */
  /*else*/ {
    if (unlikely(__pyx_v_output_param_dict == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 4835, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_output_param_dict, __pyx_n_u_tau, __pyx_int_0) < 0)) __PYX_ERR(0, 4835, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "pyross/inference.pyx":4836
 *         else:
 *             output_param_dict['tau'] = 0
 *         return output_param_dict             # <<<<<<<<<<<<<<
 * 
 *     def set_testRate(self, testRate):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output_param_dict);
  __pyx_r = __pyx_v_output_param_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4824
 * 
 * 
 *     cpdef full_time_dep_param_mapping(self, input_parameters, t):             # <<<<<<<<<<<<<<
 *         cdef dict output_param_dict
 *         if self.input_time_dep_param_mapping is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyross.inference.SppQ.full_time_dep_param_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_param_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_3full_time_dep_param_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_3full_time_dep_param_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_input_parameters = 0;
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("full_time_dep_param_mapping (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input_parameters,&__pyx_n_s_t,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input_parameters)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("full_time_dep_param_mapping", 1, 2, 2, 1); __PYX_ERR(0, 4824, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "full_time_dep_param_mapping") < 0)) __PYX_ERR(0, 4824, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_input_parameters = values[0];
    __pyx_v_t = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("full_time_dep_param_mapping", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4824, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SppQ.full_time_dep_param_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_2full_time_dep_param_mapping(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self), __pyx_v_input_parameters, __pyx_v_t);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_2full_time_dep_param_mapping(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_input_parameters, PyObject *__pyx_v_t) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("full_time_dep_param_mapping", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pyross_9inference_4SppQ_full_time_dep_param_mapping(__pyx_v_self, __pyx_v_input_parameters, __pyx_v_t, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ.full_time_dep_param_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4838
 *         return output_param_dict
 * 
 *     def set_testRate(self, testRate):             # <<<<<<<<<<<<<<
 *         self.testRate = testRate
 *         self.set_det_model(self.param_dict)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_5set_testRate(PyObject *__pyx_v_self, PyObject *__pyx_v_testRate); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_5set_testRate(PyObject *__pyx_v_self, PyObject *__pyx_v_testRate) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_testRate (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_4set_testRate(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self), ((PyObject *)__pyx_v_testRate));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_4set_testRate(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v_testRate) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("set_testRate", 0);

  /* "pyross/inference.pyx":4839
 * 
 *     def set_testRate(self, testRate):
 *         self.testRate = testRate             # <<<<<<<<<<<<<<
 *         self.set_det_model(self.param_dict)
 * 
 */
  __Pyx_INCREF(__pyx_v_testRate);
  __Pyx_GIVEREF(__pyx_v_testRate);
  __Pyx_GOTREF(__pyx_v_self->testRate);
  __Pyx_DECREF(__pyx_v_self->testRate);
  __pyx_v_self->testRate = __pyx_v_testRate;

  /* "pyross/inference.pyx":4840
 *     def set_testRate(self, testRate):
 *         self.testRate = testRate
 *         self.set_det_model(self.param_dict)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self->__pyx_base.param_dict) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx_base.param_dict);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4838
 *         return output_param_dict
 * 
 *     def set_testRate(self, testRate):             # <<<<<<<<<<<<<<
 *         self.testRate = testRate
 *         self.set_det_model(self.param_dict)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyross.inference.SppQ.set_testRate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4807
 *     """
 *     cdef:
 *         readonly dict full_model_spec             # <<<<<<<<<<<<<<
 *         readonly object input_time_dep_param_mapping
 *         readonly object input_param_mapping
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_15full_model_spec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_15full_model_spec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_15full_model_spec___get__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_15full_model_spec___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->full_model_spec);
  __pyx_r = __pyx_v_self->full_model_spec;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4808
 *     cdef:
 *         readonly dict full_model_spec
 *         readonly object input_time_dep_param_mapping             # <<<<<<<<<<<<<<
 *         readonly object input_param_mapping
 *         readonly object testRate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_28input_time_dep_param_mapping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_28input_time_dep_param_mapping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_28input_time_dep_param_mapping___get__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_28input_time_dep_param_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->input_time_dep_param_mapping);
  __pyx_r = __pyx_v_self->input_time_dep_param_mapping;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4809
 *         readonly dict full_model_spec
 *         readonly object input_time_dep_param_mapping
 *         readonly object input_param_mapping             # <<<<<<<<<<<<<<
 *         readonly object testRate
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_19input_param_mapping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_19input_param_mapping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_19input_param_mapping___get__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_19input_param_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->input_param_mapping);
  __pyx_r = __pyx_v_self->input_param_mapping;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4810
 *         readonly object input_time_dep_param_mapping
 *         readonly object input_param_mapping
 *         readonly object testRate             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_8testRate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_8testRate_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_8testRate___get__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_8testRate___get__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __pyx_r = __pyx_v_self->testRate;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_6__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_6__reduce_cython__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.full_model_spec, self.gIa, self.gIs, self.infection_terms, self.input_param_mapping, self.input_time_dep_param_mapping, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.time_dep_param_mapping, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(52); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base.__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->__pyx_base.__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.constant_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.constant_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 14, ((PyObject *)__pyx_v_self->__pyx_base.constant_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_v_self->__pyx_base.__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 17, ((PyObject *)__pyx_v_self->__pyx_base.det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.finres_pop));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.finres_pop));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->__pyx_base.finres_pop));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.finres_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.finres_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->__pyx_base.finres_terms));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 26, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa));
  __Pyx_INCREF(__pyx_v_self->full_model_spec);
  __Pyx_GIVEREF(__pyx_v_self->full_model_spec);
  PyTuple_SET_ITEM(__pyx_t_10, 27, __pyx_v_self->full_model_spec);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 28, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 29, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.infection_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.infection_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 30, ((PyObject *)__pyx_v_self->__pyx_base.infection_terms));
  __Pyx_INCREF(__pyx_v_self->input_param_mapping);
  __Pyx_GIVEREF(__pyx_v_self->input_param_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_v_self->input_param_mapping);
  __Pyx_INCREF(__pyx_v_self->input_time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_self->input_time_dep_param_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_v_self->input_time_dep_param_mapping);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.linear_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.linear_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 33, ((PyObject *)__pyx_v_self->__pyx_base.linear_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 34, __pyx_v_self->__pyx_base.__pyx_base.lyapunov_method);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.model_param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.model_param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 35, __pyx_v_self->__pyx_base.model_param_keys);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters));
  PyTuple_SET_ITEM(__pyx_t_10, 36, ((PyObject *)__pyx_v_self->__pyx_base.model_parameters));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length));
  PyTuple_SET_ITEM(__pyx_t_10, 37, ((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.model_spec);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.model_spec);
  PyTuple_SET_ITEM(__pyx_t_10, 38, __pyx_v_self->__pyx_base.model_spec);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 39, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 40, __pyx_v_self->__pyx_base.param_dict);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 41, __pyx_v_self->__pyx_base.__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 42, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.parameter_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 43, __pyx_v_self->__pyx_base.parameter_mapping);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.resource_list));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.resource_list));
  PyTuple_SET_ITEM(__pyx_t_10, 44, ((PyObject *)__pyx_v_self->__pyx_base.resource_list));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 45, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 46, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 47, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 48, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __Pyx_GIVEREF(__pyx_v_self->testRate);
  PyTuple_SET_ITEM(__pyx_t_10, 49, __pyx_v_self->testRate);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.time_dep_param_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 50, __pyx_v_self->__pyx_base.time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 51, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.full_model_spec, self.gIa, self.gIs, self.infection_terms, self.input_param_mapping, self.input_time_dep_param_mapping, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.full_model_spec, self.gIa, self.gIs, self.infection_terms, self.input_param_mapping, self.input_time_dep_param_mapping, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.full_model_spec is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.input_param_mapping is not None or self.input_time_dep_param_mapping is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.testRate is not None or self.time_dep_param_mapping is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.full_model_spec, self.gIa, self.gIs, self.infection_terms, self.input_param_mapping, self.input_time_dep_param_mapping, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.full_model_spec is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.input_param_mapping is not None or self.input_time_dep_param_mapping is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.testRate is not None or self.time_dep_param_mapping is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.constant_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.__pyx_base.contactMatrix != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.det_model) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.finres_pop) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.finres_terms) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->full_model_spec != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.infection_terms) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->input_param_mapping != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->input_time_dep_param_mapping != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.linear_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.model_param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.model_parameters) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.model_spec != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.param_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.parameter_mapping != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.resource_list) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->testRate != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.time_dep_param_mapping != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.full_model_spec is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.input_param_mapping is not None or self.input_time_dep_param_mapping is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.testRate is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.full_model_spec is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.input_param_mapping is not None or self.input_time_dep_param_mapping is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.testRate is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SppQ); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_23519854);
    __Pyx_GIVEREF(__pyx_int_23519854);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_23519854);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.full_model_spec is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.input_param_mapping is not None or self.input_time_dep_param_mapping is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.testRate is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, None), state
 *     else:
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SppQ__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SppQ); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_23519854);
    __Pyx_GIVEREF(__pyx_int_23519854);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_23519854);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SppQ.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SppQ__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_4SppQ_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_4SppQ_8__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4SppQ_8__setstate_cython__(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SppQ__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SppQ__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SppQ, (type(self), 0x166e26e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SppQ__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4865
 * 
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_8SppQ_old_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_8SppQ_old_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_model_spec = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_testRate = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  PyObject *__pyx_v_parameter_mapping = 0;
  PyObject *__pyx_v_time_dep_param_mapping = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_model_spec,&__pyx_n_s_parameters,&__pyx_n_s_testRate,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,&__pyx_n_s_parameter_mapping,&__pyx_n_s_time_dep_param_mapping,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)__pyx_int_1);
    values[6] = ((PyObject *)__pyx_int_4);
    values[7] = ((PyObject *)__pyx_n_u_LSODA);
    values[8] = ((PyObject *)__pyx_n_u_LSODA);
    values[9] = ((PyObject *)__pyx_float_1eneg_3);
    values[10] = ((PyObject *)__pyx_float_1eneg_3);

    /* "pyross/inference.pyx":4866
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):             # <<<<<<<<<<<<<<
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 */
    values[11] = ((PyObject *)Py_None);
    values[12] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model_spec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 1); __PYX_ERR(0, 4865, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_testRate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 2); __PYX_ERR(0, 4865, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 3); __PYX_ERR(0, 4865, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 4); __PYX_ERR(0, 4865, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameter_mapping);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_time_dep_param_mapping);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 4865, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_model_spec = values[0];
    __pyx_v_parameters = values[1];
    __pyx_v_testRate = values[2];
    __pyx_v_M = values[3];
    __pyx_v_fi = values[4];
    __pyx_v_Omega = values[5];
    __pyx_v_steps = values[6];
    __pyx_v_det_method = values[7];
    __pyx_v_lyapunov_method = values[8];
    __pyx_v_rtol_det = values[9];
    __pyx_v_rtol_lyapunov = values[10];
    __pyx_v_parameter_mapping = values[11];
    __pyx_v_time_dep_param_mapping = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4865, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SppQ_old.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old___init__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), __pyx_v_model_spec, __pyx_v_parameters, __pyx_v_testRate, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov, __pyx_v_parameter_mapping, __pyx_v_time_dep_param_mapping);

  /* "pyross/inference.pyx":4865
 * 
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_8SppQ_old___init__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_parameters, PyObject *__pyx_v_testRate, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping) {
  PyObject *__pyx_v_res = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_parameters);

  /* "pyross/inference.pyx":4867
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping
 */
  __pyx_t_2 = (__pyx_v_parameter_mapping != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_time_dep_param_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pyross/inference.pyx":4868
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')             # <<<<<<<<<<<<<<
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 4868, __pyx_L1_error)

    /* "pyross/inference.pyx":4867
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping
 */
  }

  /* "pyross/inference.pyx":4869
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping             # <<<<<<<<<<<<<<
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())
 */
  __Pyx_INCREF(__pyx_v_parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_parameter_mapping);
  __Pyx_GOTREF(__pyx_v_self->parameter_mapping);
  __Pyx_DECREF(__pyx_v_self->parameter_mapping);
  __pyx_v_self->parameter_mapping = __pyx_v_parameter_mapping;

  /* "pyross/inference.pyx":4870
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping             # <<<<<<<<<<<<<<
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:
 */
  __Pyx_INCREF(__pyx_v_time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_time_dep_param_mapping);
  __Pyx_GOTREF(__pyx_v_self->time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v_self->time_dep_param_mapping);
  __pyx_v_self->time_dep_param_mapping = __pyx_v_time_dep_param_mapping;

  /* "pyross/inference.pyx":4871
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())             # <<<<<<<<<<<<<<
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_parameters, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.param_keys);
  __pyx_v_self->__pyx_base.param_keys = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyross/inference.pyx":4872
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:
 */
  __pyx_t_1 = (__pyx_v_parameter_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4873
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())             # <<<<<<<<<<<<<<
 *         elif time_dep_param_mapping is not None:
 *             self.param_dict = parameters.copy()
 */
    __Pyx_INCREF(__pyx_v_parameter_mapping);
    __pyx_t_6 = __pyx_v_parameter_mapping; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_keys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PySequence_List(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->model_param_keys);
    __Pyx_DECREF(__pyx_v_self->model_param_keys);
    __pyx_v_self->model_param_keys = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":4872
 *         self.time_dep_param_mapping = time_dep_param_mapping
 *         self.param_keys = list(parameters.keys())
 *         if parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:
 */
    goto __pyx_L6;
  }

  /* "pyross/inference.pyx":4874
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.param_dict = parameters.copy()
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 */
  __pyx_t_2 = (__pyx_v_time_dep_param_mapping != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4875
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:
 *             self.param_dict = parameters.copy()             # <<<<<<<<<<<<<<
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 *         else:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_parameters, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 4875, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->param_dict);
    __Pyx_DECREF(__pyx_v_self->param_dict);
    __pyx_v_self->param_dict = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyross/inference.pyx":4876
 *         elif time_dep_param_mapping is not None:
 *             self.param_dict = parameters.copy()
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())             # <<<<<<<<<<<<<<
 *         else:
 *             self.model_param_keys = self.param_keys.copy()
 */
    __Pyx_INCREF(__pyx_v_time_dep_param_mapping);
    __pyx_t_4 = __pyx_v_time_dep_param_mapping; __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_parameters, __pyx_int_0};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4876, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_parameters, __pyx_int_0};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4876, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_parameters);
      __Pyx_GIVEREF(__pyx_v_parameters);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_parameters);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_int_0);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_List(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->model_param_keys);
    __Pyx_DECREF(__pyx_v_self->model_param_keys);
    __pyx_v_self->model_param_keys = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":4874
 *         if parameter_mapping is not None:
 *             self.model_param_keys = list(parameter_mapping(parameters).keys())
 *         elif time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.param_dict = parameters.copy()
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 */
    goto __pyx_L6;
  }

  /* "pyross/inference.pyx":4878
 *             self.model_param_keys = list(time_dep_param_mapping(parameters, 0).keys())
 *         else:
 *             self.model_param_keys = self.param_keys.copy()             # <<<<<<<<<<<<<<
 *         self.model_spec=model_spec
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.param_keys, __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 4878, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->model_param_keys);
    __Pyx_DECREF(__pyx_v_self->model_param_keys);
    __pyx_v_self->model_param_keys = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L6:;

  /* "pyross/inference.pyx":4879
 *         else:
 *             self.model_param_keys = self.param_keys.copy()
 *         self.model_spec=model_spec             # <<<<<<<<<<<<<<
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 *         self.nClass = res[0]
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_model_spec))||((__pyx_v_model_spec) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_model_spec)->tp_name), 0))) __PYX_ERR(0, 4879, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_model_spec;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->model_spec);
  __Pyx_DECREF(__pyx_v_self->model_spec);
  __pyx_v_self->model_spec = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4880
 *             self.model_param_keys = self.param_keys.copy()
 *         self.model_spec=model_spec
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)             # <<<<<<<<<<<<<<
 *         self.nClass = res[0]
 *         self.class_index_dict = res[1]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyross); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_parse_model_spec); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_model_spec, __pyx_v_self->model_param_keys};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4880, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_model_spec, __pyx_v_self->model_param_keys};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4880, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_self->model_param_keys);
    __Pyx_GIVEREF(__pyx_v_self->model_param_keys);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_self->model_param_keys);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_res = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4881
 *         self.model_spec=model_spec
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 *         self.nClass = res[0]             # <<<<<<<<<<<<<<
 *         self.class_index_dict = res[1]
 *         self.constant_terms = res[2]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4881, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_self->__pyx_base.nClass = __pyx_t_10;

  /* "pyross/inference.pyx":4882
 *         res = pyross.utils.parse_model_spec(model_spec, self.model_param_keys)
 *         self.nClass = res[0]
 *         self.class_index_dict = res[1]             # <<<<<<<<<<<<<<
 *         self.constant_terms = res[2]
 *         self.linear_terms = res[3]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 4882, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.class_index_dict);
  __pyx_v_self->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4883
 *         self.nClass = res[0]
 *         self.class_index_dict = res[1]
 *         self.constant_terms = res[2]             # <<<<<<<<<<<<<<
 *         self.linear_terms = res[3]
 *         self.infection_terms = res[4]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4883, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->constant_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->constant_terms));
  __pyx_v_self->constant_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4884
 *         self.class_index_dict = res[1]
 *         self.constant_terms = res[2]
 *         self.linear_terms = res[3]             # <<<<<<<<<<<<<<
 *         self.infection_terms = res[4]
 *         self.test_pos = res[7]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4884, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->linear_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->linear_terms));
  __pyx_v_self->linear_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4885
 *         self.constant_terms = res[2]
 *         self.linear_terms = res[3]
 *         self.infection_terms = res[4]             # <<<<<<<<<<<<<<
 *         self.test_pos = res[7]
 *         self.test_freq = res[8]
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4885, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->infection_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->infection_terms));
  __pyx_v_self->infection_terms = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4886
 *         self.linear_terms = res[3]
 *         self.infection_terms = res[4]
 *         self.test_pos = res[7]             # <<<<<<<<<<<<<<
 *         self.test_freq = res[8]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4886, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->test_pos);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->test_pos));
  __pyx_v_self->test_pos = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4887
 *         self.infection_terms = res[4]
 *         self.test_pos = res[7]
 *         self.test_freq = res[8]             # <<<<<<<<<<<<<<
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_res, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4887, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->test_freq);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->test_freq));
  __pyx_v_self->test_freq = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4888
 *         self.test_pos = res[7]
 *         self.test_freq = res[8]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SppQ_old));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SppQ_old));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SppQ_old));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_init); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[11] = {__pyx_t_5, __pyx_v_parameters, __pyx_t_9, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 10+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4888, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[11] = {__pyx_t_5, __pyx_v_parameters, __pyx_t_9, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 10+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4888, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(10+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4888, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_7, 5+__pyx_t_8, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_7, 6+__pyx_t_8, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_7, 7+__pyx_t_8, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_7, 8+__pyx_t_8, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_7, 9+__pyx_t_8, __pyx_v_rtol_lyapunov);
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4888, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4889
 *         self.test_freq = res[8]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             parameters = self.parameter_mapping(parameters)
 *         if self.time_dep_param_mapping is not None:
 */
  __pyx_t_1 = (__pyx_v_self->parameter_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4890
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)             # <<<<<<<<<<<<<<
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 */
    __Pyx_INCREF(__pyx_v_self->parameter_mapping);
    __pyx_t_6 = __pyx_v_self->parameter_mapping; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_parameters, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":4889
 *         self.test_freq = res[8]
 *         super().__init__(parameters, self.nClass, M, fi, Omega, steps, det_method, lyapunov_method, rtol_det, rtol_lyapunov)
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             parameters = self.parameter_mapping(parameters)
 *         if self.time_dep_param_mapping is not None:
 */
  }

  /* "pyross/inference.pyx":4891
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *         else:
 */
  __pyx_t_2 = (__pyx_v_self->time_dep_param_mapping != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4892
 *             parameters = self.parameter_mapping(parameters)
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)             # <<<<<<<<<<<<<<
 *         else:
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega)
 */
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_fi, __pyx_v_Omega); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_M);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_time_dep_param_mapping, __pyx_v_time_dep_param_mapping) < 0) __PYX_ERR(0, 4892, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SppQ_old), __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->det_model);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
    __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_SppQ_old *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "pyross/inference.pyx":4891
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *         else:
 */
    goto __pyx_L8;
  }

  /* "pyross/inference.pyx":4894
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *         else:
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega)             # <<<<<<<<<<<<<<
 *         self.testRate =  testRate
 *         self.det_model.set_testRate(testRate)
 */
  /*else*/ {
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_fi, __pyx_v_Omega); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_M);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SppQ_old), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->det_model);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->det_model));
    __pyx_v_self->det_model = ((struct __pyx_obj_6pyross_13deterministic_SppQ_old *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L8:;

  /* "pyross/inference.pyx":4895
 *         else:
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega)
 *         self.testRate =  testRate             # <<<<<<<<<<<<<<
 *         self.det_model.set_testRate(testRate)
 * 
 */
  __Pyx_INCREF(__pyx_v_testRate);
  __Pyx_GIVEREF(__pyx_v_testRate);
  __Pyx_GOTREF(__pyx_v_self->testRate);
  __Pyx_DECREF(__pyx_v_self->testRate);
  __pyx_v_self->testRate = __pyx_v_testRate;

  /* "pyross/inference.pyx":4896
 *             self.det_model = pyross.deterministic.SppQ_old(model_spec, parameters, M, fi*Omega)
 *         self.testRate =  testRate
 *         self.det_model.set_testRate(testRate)             # <<<<<<<<<<<<<<
 * 
 *         if self.constant_terms.size > 0:
 */
  __pyx_t_7 = ((struct __pyx_vtabstruct_6pyross_13deterministic_SppQ_old *)__pyx_v_self->det_model->__pyx_base.__pyx_vtab)->set_testRate(__pyx_v_self->det_model, __pyx_v_testRate, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":4898
 *         self.det_model.set_testRate(testRate)
 * 
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             self.nClassU = self.nClass // 2 # number of unquarantined classes with constant terms
 *             self.nClassUwoN = self.nClassU - 1
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4898, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 4898, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4899
 * 
 *         if self.constant_terms.size > 0:
 *             self.nClassU = self.nClass // 2 # number of unquarantined classes with constant terms             # <<<<<<<<<<<<<<
 *             self.nClassUwoN = self.nClassU - 1
 *         else:
 */
    __pyx_v_self->nClassU = (__pyx_v_self->__pyx_base.nClass / 2);

    /* "pyross/inference.pyx":4900
 *         if self.constant_terms.size > 0:
 *             self.nClassU = self.nClass // 2 # number of unquarantined classes with constant terms
 *             self.nClassUwoN = self.nClassU - 1             # <<<<<<<<<<<<<<
 *         else:
 *             self.nClassU = (self.nClass - 1) // 2 # number of unquarantined classes w/o constant terms
 */
    __pyx_v_self->nClassUwoN = (__pyx_v_self->nClassU - 1);

    /* "pyross/inference.pyx":4898
 *         self.det_model.set_testRate(testRate)
 * 
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             self.nClassU = self.nClass // 2 # number of unquarantined classes with constant terms
 *             self.nClassUwoN = self.nClassU - 1
 */
    goto __pyx_L9;
  }

  /* "pyross/inference.pyx":4902
 *             self.nClassUwoN = self.nClassU - 1
 *         else:
 *             self.nClassU = (self.nClass - 1) // 2 # number of unquarantined classes w/o constant terms             # <<<<<<<<<<<<<<
 *             self.nClassUwoN = self.nClassU
 * 
 */
  /*else*/ {
    __pyx_v_self->nClassU = ((__pyx_v_self->__pyx_base.nClass - 1) / 2);

    /* "pyross/inference.pyx":4903
 *         else:
 *             self.nClassU = (self.nClass - 1) // 2 # number of unquarantined classes w/o constant terms
 *             self.nClassUwoN = self.nClassU             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_10 = __pyx_v_self->nClassU;
    __pyx_v_self->nClassUwoN = __pyx_t_10;
  }
  __pyx_L9:;

  /* "pyross/inference.pyx":4865
 * 
 * 
 *     def __init__(self, model_spec, parameters, testRate, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4906
 * 
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t a = 100
 *         indices = set()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_3infection_indices(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infection_indices (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_2infection_indices(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_2infection_indices(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  Py_ssize_t __pyx_v_a;
  PyObject *__pyx_v_indices = NULL;
  PyObject *__pyx_v_linear_terms_indices = NULL;
  PyObject *__pyx_v_term = NULL;
  PyObject *__pyx_v_infective_index = NULL;
  PyObject *__pyx_v_temp = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_product_index = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("infection_indices", 0);

  /* "pyross/inference.pyx":4907
 * 
 *     def infection_indices(self):
 *         cdef Py_ssize_t a = 100             # <<<<<<<<<<<<<<
 *         indices = set()
 *         linear_terms_indices = list(range(self.linear_terms.shape[0]))
 */
  __pyx_v_a = 0x64;

  /* "pyross/inference.pyx":4908
 *     def infection_indices(self):
 *         cdef Py_ssize_t a = 100
 *         indices = set()             # <<<<<<<<<<<<<<
 *         linear_terms_indices = list(range(self.linear_terms.shape[0]))
 * 
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_indices = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4909
 *         cdef Py_ssize_t a = 100
 *         indices = set()
 *         linear_terms_indices = list(range(self.linear_terms.shape[0]))             # <<<<<<<<<<<<<<
 * 
 *         # Find all the infection terms
 */
  __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_self->linear_terms->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_linear_terms_indices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4912
 * 
 *         # Find all the infection terms
 *         for term in self.infection_terms:             # <<<<<<<<<<<<<<
 *             infective_index = term[1]
 *             indices.add(infective_index)
 */
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->infection_terms))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->infection_terms))) {
    __pyx_t_1 = ((PyObject *)__pyx_v_self->infection_terms); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->infection_terms)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4912, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4912, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4912, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4912, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4912, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 4912, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_term, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4913
 *         # Find all the infection terms
 *         for term in self.infection_terms:
 *             infective_index = term[1]             # <<<<<<<<<<<<<<
 *             indices.add(infective_index)
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_term, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_infective_index, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyross/inference.pyx":4914
 *         for term in self.infection_terms:
 *             infective_index = term[1]
 *             indices.add(infective_index)             # <<<<<<<<<<<<<<
 * 
 *         # Find all the terms that turn into infection terms
 */
    __pyx_t_5 = PySet_Add(__pyx_v_indices, __pyx_v_infective_index); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 4914, __pyx_L1_error)

    /* "pyross/inference.pyx":4912
 * 
 *         # Find all the infection terms
 *         for term in self.infection_terms:             # <<<<<<<<<<<<<<
 *             infective_index = term[1]
 *             indices.add(infective_index)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4917
 * 
 *         # Find all the terms that turn into infection terms
 *         a = 100             # <<<<<<<<<<<<<<
 *         while a > 0:
 *             a = 0
 */
  __pyx_v_a = 0x64;

  /* "pyross/inference.pyx":4918
 *         # Find all the terms that turn into infection terms
 *         a = 100
 *         while a > 0:             # <<<<<<<<<<<<<<
 *             a = 0
 *             temp = linear_terms_indices.copy()
 */
  while (1) {
    __pyx_t_6 = ((__pyx_v_a > 0) != 0);
    if (!__pyx_t_6) break;

    /* "pyross/inference.pyx":4919
 *         a = 100
 *         while a > 0:
 *             a = 0             # <<<<<<<<<<<<<<
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:
 */
    __pyx_v_a = 0;

    /* "pyross/inference.pyx":4920
 *         while a > 0:
 *             a = 0
 *             temp = linear_terms_indices.copy()             # <<<<<<<<<<<<<<
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_linear_terms_indices, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_temp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4921
 *             a = 0
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:             # <<<<<<<<<<<<<<
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:
 */
    if (likely(PyList_CheckExact(__pyx_v_linear_terms_indices)) || PyTuple_CheckExact(__pyx_v_linear_terms_indices)) {
      __pyx_t_1 = __pyx_v_linear_terms_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_linear_terms_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4921, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4921, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4921, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4921, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 4921, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4921, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_4(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 4921, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pyross/inference.pyx":4922
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]             # <<<<<<<<<<<<<<
 *                 if product_index in indices:
 *                     a += 1
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_2);
      __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->linear_terms), __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_product_index, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyross/inference.pyx":4923
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:             # <<<<<<<<<<<<<<
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])
 */
      __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_v_product_index, __pyx_v_indices, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 4923, __pyx_L1_error)
      __pyx_t_8 = (__pyx_t_6 != 0);
      if (__pyx_t_8) {

        /* "pyross/inference.pyx":4924
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:
 *                     a += 1             # <<<<<<<<<<<<<<
 *                     indices.add(self.linear_terms[i, 1])
 *                     temp.remove(i)
 */
        __pyx_v_a = (__pyx_v_a + 1);

        /* "pyross/inference.pyx":4925
 *                 if product_index in indices:
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])             # <<<<<<<<<<<<<<
 *                     temp.remove(i)
 *             linear_terms_indices = temp
 */
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_i);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_1);
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->linear_terms), __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_5 = PySet_Add(__pyx_v_indices, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 4925, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pyross/inference.pyx":4926
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])
 *                     temp.remove(i)             # <<<<<<<<<<<<<<
 *             linear_terms_indices = temp
 *         return list(indices)
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_temp, __pyx_n_s_remove); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_v_i) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_i);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pyross/inference.pyx":4923
 *             for i in linear_terms_indices:
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:             # <<<<<<<<<<<<<<
 *                     a += 1
 *                     indices.add(self.linear_terms[i, 1])
 */
      }

      /* "pyross/inference.pyx":4921
 *             a = 0
 *             temp = linear_terms_indices.copy()
 *             for i in linear_terms_indices:             # <<<<<<<<<<<<<<
 *                 product_index = self.linear_terms[i, 2]
 *                 if product_index in indices:
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyross/inference.pyx":4927
 *                     indices.add(self.linear_terms[i, 1])
 *                     temp.remove(i)
 *             linear_terms_indices = temp             # <<<<<<<<<<<<<<
 *         return list(indices)
 * 
 */
    __Pyx_INCREF(__pyx_v_temp);
    __Pyx_DECREF_SET(__pyx_v_linear_terms_indices, __pyx_v_temp);
  }

  /* "pyross/inference.pyx":4928
 *                     temp.remove(i)
 *             linear_terms_indices = temp
 *         return list(indices)             # <<<<<<<<<<<<<<
 * 
 *     def set_params(self, parameters):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(__pyx_v_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4906
 * 
 * 
 *     def infection_indices(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t a = 100
 *         indices = set()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.infection_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XDECREF(__pyx_v_linear_terms_indices);
  __Pyx_XDECREF(__pyx_v_term);
  __Pyx_XDECREF(__pyx_v_infective_index);
  __Pyx_XDECREF(__pyx_v_temp);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_product_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4930
 *         return list(indices)
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_5set_params(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_params (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_4set_params(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_4set_params(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_parameters) {
  Py_ssize_t __pyx_v_nParams;
  PyObject *__pyx_v_model_parameters = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_param = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("set_params", 0);

  /* "pyross/inference.pyx":4931
 * 
 *     def set_params(self, parameters):
 *         if self.det_model is not None:             # <<<<<<<<<<<<<<
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4932
 *     def set_params(self, parameters):
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)             # <<<<<<<<<<<<<<
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_det_model); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4931
 * 
 *     def set_params(self, parameters):
 *         if self.det_model is not None:             # <<<<<<<<<<<<<<
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)
 */
  }

  /* "pyross/inference.pyx":4933
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)             # <<<<<<<<<<<<<<
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.param_keys;
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 4933, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_nParams = __pyx_t_6;

  /* "pyross/inference.pyx":4934
 *             self.set_det_model(parameters)
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             model_parameters = self.parameter_mapping(parameters)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_parameters, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 4934, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->param_dict);
  __Pyx_DECREF(__pyx_v_self->param_dict);
  __pyx_v_self->param_dict = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":4935
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)
 */
  __pyx_t_2 = (__pyx_v_self->parameter_mapping != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyross/inference.pyx":4936
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:
 *             model_parameters = self.parameter_mapping(parameters)             # <<<<<<<<<<<<<<
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 */
    __Pyx_INCREF(__pyx_v_self->parameter_mapping);
    __pyx_t_4 = __pyx_v_self->parameter_mapping; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_model_parameters = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4937
 *         if self.parameter_mapping is not None:
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)             # <<<<<<<<<<<<<<
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:
 */
    __pyx_t_3 = __pyx_v_self->model_param_keys;
    __Pyx_INCREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 4937, __pyx_L1_error)
    }
    __pyx_t_6 = PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4937, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_nParams = __pyx_t_6;

    /* "pyross/inference.pyx":4938
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4938, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->model_parameters);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters));
    __pyx_v_self->model_parameters = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4939
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pyross/inference.pyx":4940
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_3 = __pyx_int_0;
        __pyx_t_7 = __pyx_v_self->model_param_keys; __Pyx_INCREF(__pyx_t_7); __pyx_t_6 = 0;
        for (;;) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 4940, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4940, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
          __pyx_t_5 = 0;
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
          __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4940, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3);
          __pyx_t_3 = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4941
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]             # <<<<<<<<<<<<<<
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *             except KeyError:
 */
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_model_parameters, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4941, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4942
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 */
          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyross); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4942, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4942, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4942, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4942, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = NULL;
          __pyx_t_13 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
              __pyx_t_13 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_param, __pyx_t_11, __pyx_v_key};
            __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4942, __pyx_L5_error)
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_param, __pyx_t_11, __pyx_v_key};
            __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4942, __pyx_L5_error)
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          } else
          #endif
          {
            __pyx_t_14 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4942, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_14);
            if (__pyx_t_12) {
              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
            }
            __Pyx_INCREF(__pyx_v_param);
            __Pyx_GIVEREF(__pyx_v_param);
            PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_v_param);
            __Pyx_GIVEREF(__pyx_t_11);
            PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_11);
            __Pyx_INCREF(__pyx_v_key);
            __Pyx_GIVEREF(__pyx_v_key);
            PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_13, __pyx_v_key);
            __pyx_t_11 = 0;
            __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4942, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_v_i, __pyx_t_5) < 0)) __PYX_ERR(0, 4942, __pyx_L5_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "pyross/inference.pyx":4940
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:
 *                 for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pyross/inference.pyx":4939
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 */
      }
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L10_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyross/inference.pyx":4943
 *                     param = model_parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:
 */
      __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_13) {
        __Pyx_AddTraceback("pyross.inference.SppQ_old.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 4943, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_5);

        /* "pyross/inference.pyx":4944
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))             # <<<<<<<<<<<<<<
 *         elif self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(0)
 */
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_The_parameters_returned_by_param, __pyx_n_s_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4944, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_4 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_11, __pyx_v_self->model_param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_self->model_param_keys);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4944, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4944, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_14, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __PYX_ERR(0, 4944, __pyx_L7_except_error)
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;

      /* "pyross/inference.pyx":4939
 *             nParams = len(self.model_param_keys)
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.model_param_keys):
 *                     param = model_parameters[key]
 */
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L10_try_end:;
    }

    /* "pyross/inference.pyx":4935
 *         nParams = len(self.param_keys)
 *         self.param_dict = parameters.copy()
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             model_parameters = self.parameter_mapping(parameters)
 *             nParams = len(self.model_param_keys)
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":4945
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(0)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->time_dep_param_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4946
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(0)             # <<<<<<<<<<<<<<
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_time_dep_model_parameters); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":4945
 *             except KeyError:
 *                 raise Exception('The parameters returned by parameter_mapping(...) do not contain certain keys. The keys are {}'.format(self.model_param_keys))
 *         elif self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(0)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":4948
 *             self.set_time_dep_model_parameters(0)
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_14);
    __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4948, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->model_parameters);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters));
    __pyx_v_self->model_parameters = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":4949
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "pyross/inference.pyx":4950
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):             # <<<<<<<<<<<<<<
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_5 = __pyx_int_0;
        __pyx_t_14 = __pyx_v_self->__pyx_base.param_keys; __Pyx_INCREF(__pyx_t_14); __pyx_t_6 = 0;
        for (;;) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_14)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 4950, __pyx_L15_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4950, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
          __pyx_t_3 = 0;
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
          __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4950, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5);
          __pyx_t_5 = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "pyross/inference.pyx":4951
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]             # <<<<<<<<<<<<<<
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *             except KeyError:
 */
          __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_parameters, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4951, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "pyross/inference.pyx":4952
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyross); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4952, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4952, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4952, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4952, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = NULL;
          __pyx_t_13 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_13 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_param, __pyx_t_4, __pyx_v_key};
            __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4952, __pyx_L15_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_param, __pyx_t_4, __pyx_v_key};
            __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4952, __pyx_L15_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else
          #endif
          {
            __pyx_t_12 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4952, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_11) {
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
            }
            __Pyx_INCREF(__pyx_v_param);
            __Pyx_GIVEREF(__pyx_v_param);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_13, __pyx_v_param);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_13, __pyx_t_4);
            __Pyx_INCREF(__pyx_v_key);
            __Pyx_GIVEREF(__pyx_v_key);
            PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_13, __pyx_v_key);
            __pyx_t_4 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4952, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_v_i, __pyx_t_3) < 0)) __PYX_ERR(0, 4952, __pyx_L15_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "pyross/inference.pyx":4950
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:
 *                 for (i, key) in enumerate(self.param_keys):             # <<<<<<<<<<<<<<
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4949
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 */
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L20_try_end;
      __pyx_L15_error:;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyross/inference.pyx":4953
 *                     param = parameters[key]
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))
 * 
 */
      __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_13) {
        __Pyx_AddTraceback("pyross.inference.SppQ_old.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_14, &__pyx_t_3) < 0) __PYX_ERR(0, 4953, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GOTREF(__pyx_t_3);

        /* "pyross/inference.pyx":4954
 *                     self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *             except KeyError:
 *                 raise Exception('The parameters passed do not contain certain keys. The keys are {}'.format(self.param_keys))             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_The_parameters_passed_do_not_con, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4954, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_4, __pyx_v_self->__pyx_base.param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_self->__pyx_base.param_keys);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4954, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4954, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_12, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __PYX_ERR(0, 4954, __pyx_L17_except_error)
      }
      goto __pyx_L17_except_error;
      __pyx_L17_except_error:;

      /* "pyross/inference.pyx":4949
 *         else:
 *             self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *             try:             # <<<<<<<<<<<<<<
 *                 for (i, key) in enumerate(self.param_keys):
 *                     param = parameters[key]
 */
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L20_try_end:;
    }
  }
  __pyx_L4:;

  /* "pyross/inference.pyx":4930
 *         return list(indices)
 * 
 *     def set_params(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.det_model is not None:
 *             self.set_det_model(parameters)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.set_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_model_parameters);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_param);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4957
 * 
 * 
 *     def set_time_dep_model_parameters(self, tt):             # <<<<<<<<<<<<<<
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_7set_time_dep_model_parameters(PyObject *__pyx_v_self, PyObject *__pyx_v_tt); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_7set_time_dep_model_parameters(PyObject *__pyx_v_self, PyObject *__pyx_v_tt) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_time_dep_model_parameters (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_6set_time_dep_model_parameters(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), ((PyObject *)__pyx_v_tt));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_6set_time_dep_model_parameters(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_tt) {
  PyObject *__pyx_v_model_parameters = NULL;
  Py_ssize_t __pyx_v_nParams;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_param = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("set_time_dep_model_parameters", 0);

  /* "pyross/inference.pyx":4958
 * 
 *     def set_time_dep_model_parameters(self, tt):
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)             # <<<<<<<<<<<<<<
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 */
  __Pyx_INCREF(__pyx_v_self->time_dep_param_mapping);
  __pyx_t_2 = __pyx_v_self->time_dep_param_mapping; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->param_dict, __pyx_v_tt};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4958, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->param_dict, __pyx_v_tt};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4958, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self->param_dict);
    __Pyx_GIVEREF(__pyx_v_self->param_dict);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self->param_dict);
    __Pyx_INCREF(__pyx_v_tt);
    __Pyx_GIVEREF(__pyx_v_tt);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_tt);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_model_parameters = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4959
 *     def set_time_dep_model_parameters(self, tt):
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)             # <<<<<<<<<<<<<<
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         try:
 */
  __pyx_t_1 = __pyx_v_self->model_param_keys;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 4959, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nParams = __pyx_t_6;

  /* "pyross/inference.pyx":4960
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_nParams); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4960, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->model_parameters);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->model_parameters));
  __pyx_v_self->model_parameters = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4961
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         try:             # <<<<<<<<<<<<<<
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "pyross/inference.pyx":4962
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_t_1 = __pyx_int_0;
      __pyx_t_3 = __pyx_v_self->model_param_keys; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
      for (;;) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 4962, __pyx_L3_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4962, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
        __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4962, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1);
        __pyx_t_1 = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4963
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]             # <<<<<<<<<<<<<<
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *         except KeyError:
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_model_parameters, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4963, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4964
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             raise Exception('The parameters passed do not contain certain keys.\
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4964, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_utils); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4964, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_age_dep_rates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4964, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4964, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_4 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_param, __pyx_t_10, __pyx_v_key};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4964, __pyx_L3_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_param, __pyx_t_10, __pyx_v_key};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4964, __pyx_L3_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4964, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
          }
          __Pyx_INCREF(__pyx_v_param);
          __Pyx_GIVEREF(__pyx_v_param);
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_4, __pyx_v_param);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_4, __pyx_t_10);
          __Pyx_INCREF(__pyx_v_key);
          __Pyx_GIVEREF(__pyx_v_key);
          PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_4, __pyx_v_key);
          __pyx_t_10 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4964, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->model_parameters), __pyx_v_i, __pyx_t_5) < 0)) __PYX_ERR(0, 4964, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "pyross/inference.pyx":4962
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         try:
 *             for (i, key) in enumerate(self.model_param_keys):             # <<<<<<<<<<<<<<
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyross/inference.pyx":4961
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         try:             # <<<<<<<<<<<<<<
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":4965
 *                 param = model_parameters[key]
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise Exception('The parameters passed do not contain certain keys.\
 *                              The keys are {}'.format(self.param_keys))
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("pyross.inference.SppQ_old.set_time_dep_model_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 4965, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_5);

      /* "pyross/inference.pyx":4967
 *         except KeyError:
 *             raise Exception('The parameters passed do not contain certain keys.\
 *                              The keys are {}'.format(self.param_keys))             # <<<<<<<<<<<<<<
 * 
 *     def set_testRate(self, testRate):
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_The_parameters_passed_do_not_con_2, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4967, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_v_self->__pyx_base.param_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_self->__pyx_base.param_keys);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4967, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "pyross/inference.pyx":4966
 *                 self.model_parameters[i] = pyross.utils.age_dep_rates(param, self.M, key)
 *         except KeyError:
 *             raise Exception('The parameters passed do not contain certain keys.\             # <<<<<<<<<<<<<<
 *                              The keys are {}'.format(self.param_keys))
 * 
 */
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4966, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_12, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(0, 4966, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyross/inference.pyx":4961
 *         nParams = len(self.model_param_keys)
 *         self.model_parameters = np.empty((nParams, self.M), dtype=DTYPE)
 *         try:             # <<<<<<<<<<<<<<
 *             for (i, key) in enumerate(self.model_param_keys):
 *                 param = model_parameters[key]
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "pyross/inference.pyx":4957
 * 
 * 
 *     def set_time_dep_model_parameters(self, tt):             # <<<<<<<<<<<<<<
 *         model_parameters = self.time_dep_param_mapping(self.param_dict, tt)
 *         nParams = len(self.model_param_keys)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.set_time_dep_model_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_model_parameters);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_param);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4969
 *                              The keys are {}'.format(self.param_keys))
 * 
 *     def set_testRate(self, testRate):             # <<<<<<<<<<<<<<
 *         self.testRate=testRate
 *         self.det_model.set_testRate(testRate)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_9set_testRate(PyObject *__pyx_v_self, PyObject *__pyx_v_testRate); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_9set_testRate(PyObject *__pyx_v_self, PyObject *__pyx_v_testRate) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_testRate (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_8set_testRate(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), ((PyObject *)__pyx_v_testRate));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_8set_testRate(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_testRate) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_testRate", 0);

  /* "pyross/inference.pyx":4970
 * 
 *     def set_testRate(self, testRate):
 *         self.testRate=testRate             # <<<<<<<<<<<<<<
 *         self.det_model.set_testRate(testRate)
 * 
 */
  __Pyx_INCREF(__pyx_v_testRate);
  __Pyx_GIVEREF(__pyx_v_testRate);
  __Pyx_GOTREF(__pyx_v_self->testRate);
  __Pyx_DECREF(__pyx_v_self->testRate);
  __pyx_v_self->testRate = __pyx_v_testRate;

  /* "pyross/inference.pyx":4971
 *     def set_testRate(self, testRate):
 *         self.testRate=testRate
 *         self.det_model.set_testRate(testRate)             # <<<<<<<<<<<<<<
 * 
 *     def set_det_model(self, parameters):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pyross_13deterministic_SppQ_old *)__pyx_v_self->det_model->__pyx_base.__pyx_vtab)->set_testRate(__pyx_v_self->det_model, __pyx_v_testRate, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4969
 *                              The keys are {}'.format(self.param_keys))
 * 
 *     def set_testRate(self, testRate):             # <<<<<<<<<<<<<<
 *         self.testRate=testRate
 *         self.det_model.set_testRate(testRate)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.set_testRate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4973
 *         self.det_model.set_testRate(testRate)
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_11set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_11set_det_model(PyObject *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_det_model (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_10set_det_model(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), ((PyObject *)__pyx_v_parameters));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10set_det_model(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v_parameters) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("set_det_model", 0);

  /* "pyross/inference.pyx":4974
 * 
 *     def set_det_model(self, parameters):
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->parameter_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyross/inference.pyx":4975
 *     def set_det_model(self, parameters):
 *         if self.parameter_mapping is not None:
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))             # <<<<<<<<<<<<<<
 *         else:
 *             self.det_model.update_model_parameters(parameters)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->det_model), __pyx_n_s_update_model_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_self->parameter_mapping);
    __pyx_t_6 = __pyx_v_self->parameter_mapping; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":4974
 * 
 *     def set_det_model(self, parameters):
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyross/inference.pyx":4977
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 *         else:
 *             self.det_model.update_model_parameters(parameters)             # <<<<<<<<<<<<<<
 *         self.det_model.set_testRate(self.testRate)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->det_model), __pyx_n_s_update_model_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pyross/inference.pyx":4978
 *         else:
 *             self.det_model.update_model_parameters(parameters)
 *         self.det_model.set_testRate(self.testRate)             # <<<<<<<<<<<<<<
 * 
 *     def make_params_dict(self):
 */
  __pyx_t_3 = __pyx_v_self->testRate;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pyross_13deterministic_SppQ_old *)__pyx_v_self->det_model->__pyx_base.__pyx_vtab)->set_testRate(__pyx_v_self->det_model, __pyx_t_3, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyross/inference.pyx":4973
 *         self.det_model.set_testRate(testRate)
 * 
 *     def set_det_model(self, parameters):             # <<<<<<<<<<<<<<
 *         if self.parameter_mapping is not None:
 *             self.det_model.update_model_parameters(self.parameter_mapping(parameters))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.set_det_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4980
 *         self.det_model.set_testRate(self.testRate)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         param_dict = self.param_dict.copy()
 *         return param_dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_13make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_13make_params_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_params_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_12make_params_dict(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_12make_params_dict(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_v_param_dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("make_params_dict", 0);

  /* "pyross/inference.pyx":4981
 * 
 *     def make_params_dict(self):
 *         param_dict = self.param_dict.copy()             # <<<<<<<<<<<<<<
 *         return param_dict
 * 
 */
  if (unlikely(__pyx_v_self->param_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
    __PYX_ERR(0, 4981, __pyx_L1_error)
  }
  __pyx_t_1 = PyDict_Copy(__pyx_v_self->param_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_param_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4982
 *     def make_params_dict(self):
 *         param_dict = self.param_dict.copy()
 *         return param_dict             # <<<<<<<<<<<<<<
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_param_dict);
  __pyx_r = __pyx_v_param_dict;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4980
 *         self.det_model.set_testRate(self.testRate)
 * 
 *     def make_params_dict(self):             # <<<<<<<<<<<<<<
 *         param_dict = self.param_dict.copy()
 *         return param_dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.make_params_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4984
 *         return param_dict
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray r
 */

static PyArrayObject *__pyx_f_6pyross_9inference_8SppQ_old__get_r_from_x(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x) {
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_v_xrs = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_get_r_from_x", 0);

  /* "pyross/inference.pyx":4987
 *         cdef:
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)             # <<<<<<<<<<<<<<
 *         r = self.fi - xrs[-1,:] - np.sum(xrs[:self.nClassUwoN,:], axis=0) # subtract total quarantined and all non-quarantined classes
 *         return r
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_self->__pyx_base.dim / __pyx_v_self->__pyx_base.M)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4987, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4987, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4987, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4987, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4987, __pyx_L1_error)
  __pyx_v_xrs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4988
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         r = self.fi - xrs[-1,:] - np.sum(xrs[:self.nClassUwoN,:], axis=0) # subtract total quarantined and all non-quarantined classes             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_tuple__48); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_self->__pyx_base.fi), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->nClassUwoN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PySlice_New(Py_None, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice_);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 4988, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4988, __pyx_L1_error)
  __pyx_v_r = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":4989
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         r = self.fi - xrs[-1,:] - np.sum(xrs[:self.nClassUwoN,:], axis=0) # subtract total quarantined and all non-quarantined classes
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     cdef np.ndarray _get_rq_from_x(self, np.ndarray x):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_r));
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4984
 *         return param_dict
 * 
 *     cdef np.ndarray _get_r_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray r
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SppQ_old._get_r_from_x", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_xrs);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4991
 *         return r
 * 
 *     cdef np.ndarray _get_rq_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray r
 */

static PyArrayObject *__pyx_f_6pyross_9inference_8SppQ_old__get_rq_from_x(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x) {
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_v_xrs = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_get_rq_from_x", 0);

  /* "pyross/inference.pyx":4994
 *         cdef:
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)             # <<<<<<<<<<<<<<
 *         r = xrs[-1,:] - np.sum(xrs[self.nClassU:-1,:], axis=0) # subtract all quarantined classes
 *         return r
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_self->__pyx_base.dim / __pyx_v_self->__pyx_base.M)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4994, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4994, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4994, __pyx_L1_error)
  __pyx_v_xrs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":4995
 *             np.ndarray r
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         r = xrs[-1,:] - np.sum(xrs[self.nClassU:-1,:], axis=0) # subtract all quarantined classes             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_tuple__48); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->nClassU); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PySlice_New(__pyx_t_2, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice_);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_xrs), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 4995, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4995, __pyx_L1_error)
  __pyx_v_r = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":4996
 *             np.ndarray xrs=x.reshape(int(self.dim/self.M), self.M)
 *         r = xrs[-1,:] - np.sum(xrs[self.nClassU:-1,:], axis=0) # subtract all quarantined classes
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def _all_positive(self, np.ndarray x0):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_r));
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4991
 *         return r
 * 
 *     cdef np.ndarray _get_rq_from_x(self, np.ndarray x):             # <<<<<<<<<<<<<<
 *         cdef:
 *             np.ndarray r
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyross.inference.SppQ_old._get_rq_from_x", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_xrs);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4998
 *         return r
 * 
 *     def _all_positive(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         r = self._get_r_from_x(x0)
 *         rq = self._get_rq_from_x(x0)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_15_all_positive(PyObject *__pyx_v_self, PyObject *__pyx_v_x0); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_15_all_positive(PyObject *__pyx_v_self, PyObject *__pyx_v_x0) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_all_positive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x0), __pyx_ptype_5numpy_ndarray, 1, "x0", 0))) __PYX_ERR(0, 4998, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_14_all_positive(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), ((PyArrayObject *)__pyx_v_x0));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_14_all_positive(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x0) {
  PyArrayObject *__pyx_v_r = NULL;
  PyArrayObject *__pyx_v_rq = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_all_positive", 0);

  /* "pyross/inference.pyx":4999
 * 
 *     def _all_positive(self, np.ndarray x0):
 *         r = self._get_r_from_x(x0)             # <<<<<<<<<<<<<<
 *         rq = self._get_rq_from_x(x0)
 *         return (x0 >0).all() and (r > 0).all() and (rq > 0).all()
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._get_r_from_x(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":5000
 *     def _all_positive(self, np.ndarray x0):
 *         r = self._get_r_from_x(x0)
 *         rq = self._get_rq_from_x(x0)             # <<<<<<<<<<<<<<
 *         return (x0 >0).all() and (r > 0).all() and (rq > 0).all()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_rq_from_x(__pyx_v_self, __pyx_v_x0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rq = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":5001
 *         r = self._get_r_from_x(x0)
 *         rq = self._get_rq_from_x(x0)
 *         return (x0 >0).all() and (r > 0).all() and (rq > 0).all()             # <<<<<<<<<<<<<<
 * 
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_x0), __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 5001, __pyx_L1_error)
  if (__pyx_t_5) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_r), __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 5001, __pyx_L1_error)
  if (__pyx_t_5) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_rq), __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":4998
 *         return r
 * 
 *     def _all_positive(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         r = self._get_r_from_x(x0)
 *         rq = self._get_rq_from_x(x0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyross.inference.SppQ_old._all_positive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_rq);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5003
 *         return (x0 >0).all() and (r > 0).all() and (rq > 0).all()
 * 
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double eps=0.1/self.Omega, dev
 */

static double __pyx_f_6pyross_9inference_8SppQ_old__penalty_from_negative_values(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyArrayObject *__pyx_v_x0) {
  double __pyx_v_eps;
  double __pyx_v_dev;
  PyArrayObject *__pyx_v_R_init = 0;
  PyArrayObject *__pyx_v_RQ_init = 0;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("_penalty_from_negative_values", 0);

  /* "pyross/inference.pyx":5005
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):
 *         cdef:
 *             double eps=0.1/self.Omega, dev             # <<<<<<<<<<<<<<
 *             np.ndarray R_init, RQ_init
 *         R_init = self._get_r_from_x(x0)
 */
  __pyx_v_eps = (0.1 / __pyx_v_self->__pyx_base.Omega);

  /* "pyross/inference.pyx":5007
 *             double eps=0.1/self.Omega, dev
 *             np.ndarray R_init, RQ_init
 *         R_init = self._get_r_from_x(x0)             # <<<<<<<<<<<<<<
 *         RQ_init = self._get_rq_from_x(x0)
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(RQ_init[RQ_init<0]) + np.sum(x0[x0<0]))
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._get_r_from_x(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), __pyx_v_x0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_R_init = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":5008
 *             np.ndarray R_init, RQ_init
 *         R_init = self._get_r_from_x(x0)
 *         RQ_init = self._get_rq_from_x(x0)             # <<<<<<<<<<<<<<
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(RQ_init[RQ_init<0]) + np.sum(x0[x0<0]))
 *         return (dev/eps)**2 + (dev/eps)**8
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_rq_from_x(__pyx_v_self, __pyx_v_x0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_RQ_init = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyross/inference.pyx":5009
 *         R_init = self._get_r_from_x(x0)
 *         RQ_init = self._get_rq_from_x(x0)
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(RQ_init[RQ_init<0]) + np.sum(x0[x0<0]))             # <<<<<<<<<<<<<<
 *         return (dev/eps)**2 + (dev/eps)**8
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_R_init), __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_R_init), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_RQ_init), __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_RQ_init), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x0), __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x0), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Negative(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5009, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_dev = __pyx_t_6;

  /* "pyross/inference.pyx":5010
 *         RQ_init = self._get_rq_from_x(x0)
 *         dev = - (np.sum(R_init[R_init<0]) + np.sum(RQ_init[RQ_init<0]) + np.sum(x0[x0<0]))
 *         return (dev/eps)**2 + (dev/eps)**8             # <<<<<<<<<<<<<<
 * 
 *     cdef calculate_test_r(self, double [:] x, double [:] r, double TR):
 */
  __pyx_r = (pow((__pyx_v_dev / __pyx_v_eps), 2.0) + pow((__pyx_v_dev / __pyx_v_eps), 8.0));
  goto __pyx_L0;

  /* "pyross/inference.pyx":5003
 *         return (x0 >0).all() and (r > 0).all() and (rq > 0).all()
 * 
 *     cdef double _penalty_from_negative_values(self, np.ndarray x0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double eps=0.1/self.Omega, dev
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("pyross.inference.SppQ_old._penalty_from_negative_values", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_R_init);
  __Pyx_XDECREF((PyObject *)__pyx_v_RQ_init);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5012
 *         return (dev/eps)**2 + (dev/eps)**8
 * 
 *     cdef calculate_test_r(self, double [:] x, double [:] r, double TR):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN, M=self.M
 */

static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_calculate_test_r(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_r, double __pyx_v_TR) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_nClass;
  CYTHON_UNUSED Py_ssize_t __pyx_v_nClassU;
  Py_ssize_t __pyx_v_nClassUwoN;
  Py_ssize_t __pyx_v_M;
  __Pyx_memviewslice __pyx_v_test_freq = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_Omega;
  double __pyx_v_ntestpop;
  double __pyx_v_tau0;
  __Pyx_memviewslice __pyx_v_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_4;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __Pyx_RefNannySetupContext("calculate_test_r", 0);
  __PYX_INC_MEMVIEW(&__pyx_v_r, 1);

  /* "pyross/inference.pyx":5014
 *     cdef calculate_test_r(self, double [:] x, double [:] r, double TR):
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN, M=self.M             # <<<<<<<<<<<<<<
 *             int [:] test_freq=self.test_freq
 *             double [:] fi=self.fi
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.nClass;
  __pyx_v_nClass = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassU;
  __pyx_v_nClassU = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassUwoN;
  __pyx_v_nClassUwoN = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":5015
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN, M=self.M
 *             int [:] test_freq=self.test_freq             # <<<<<<<<<<<<<<
 *             double [:] fi=self.fi
 *             double Omega = self.Omega
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_v_self->test_freq), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 5015, __pyx_L1_error)
  __pyx_v_test_freq = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":5016
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN, M=self.M
 *             int [:] test_freq=self.test_freq
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 *             double Omega = self.Omega
 *             double ntestpop=0, tau0=0
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 5016, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":5017
 *             int [:] test_freq=self.test_freq
 *             double [:] fi=self.fi
 *             double Omega = self.Omega             # <<<<<<<<<<<<<<
 *             double ntestpop=0, tau0=0
 *             double [:, :] parameters=self.model_parameters
 */
  __pyx_t_4 = __pyx_v_self->__pyx_base.Omega;
  __pyx_v_Omega = __pyx_t_4;

  /* "pyross/inference.pyx":5018
 *             double [:] fi=self.fi
 *             double Omega = self.Omega
 *             double ntestpop=0, tau0=0             # <<<<<<<<<<<<<<
 *             double [:, :] parameters=self.model_parameters
 *             Py_ssize_t m, i
 */
  __pyx_v_ntestpop = 0.0;
  __pyx_v_tau0 = 0.0;

  /* "pyross/inference.pyx":5019
 *             double Omega = self.Omega
 *             double ntestpop=0, tau0=0
 *             double [:, :] parameters=self.model_parameters             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, i
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->model_parameters), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 5019, __pyx_L1_error)
  __pyx_v_parameters = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":5023
 * 
 *         # Compute non-quarantined recovered
 *         r = self._get_r_from_x(np.array(x))             # <<<<<<<<<<<<<<
 *         # Compute normalisation of testing rates
 *         for m in range(M):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5023, __pyx_L1_error)
  __pyx_t_8 = ((PyObject *)((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._get_r_from_x(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v_self), ((PyArrayObject *)__pyx_t_6))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 5023, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_r, 1);
  __pyx_v_r = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":5025
 *         r = self._get_r_from_x(np.array(x))
 *         # Compute normalisation of testing rates
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for i in range(nClassUwoN):
 *                 ntestpop += parameters[test_freq[i], m] * x[i*M+m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_10 = __pyx_t_1;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_m = __pyx_t_11;

    /* "pyross/inference.pyx":5026
 *         # Compute normalisation of testing rates
 *         for m in range(M):
 *             for i in range(nClassUwoN):             # <<<<<<<<<<<<<<
 *                 ntestpop += parameters[test_freq[i], m] * x[i*M+m]
 *             ntestpop += parameters[test_freq[nClassUwoN], m] * r[m]
 */
    __pyx_t_12 = __pyx_v_nClassUwoN;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_i = __pyx_t_14;

      /* "pyross/inference.pyx":5027
 *         for m in range(M):
 *             for i in range(nClassUwoN):
 *                 ntestpop += parameters[test_freq[i], m] * x[i*M+m]             # <<<<<<<<<<<<<<
 *             ntestpop += parameters[test_freq[nClassUwoN], m] * r[m]
 *         tau0 = TR / (Omega * ntestpop)
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_15 * __pyx_v_test_freq.strides[0]) )));
      __pyx_t_17 = __pyx_v_m;
      __pyx_t_18 = ((__pyx_v_i * __pyx_v_M) + __pyx_v_m);
      __pyx_v_ntestpop = (__pyx_v_ntestpop + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_16 * __pyx_v_parameters.strides[0]) ) + __pyx_t_17 * __pyx_v_parameters.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_18 * __pyx_v_x.strides[0]) )))));
    }

    /* "pyross/inference.pyx":5028
 *             for i in range(nClassUwoN):
 *                 ntestpop += parameters[test_freq[i], m] * x[i*M+m]
 *             ntestpop += parameters[test_freq[nClassUwoN], m] * r[m]             # <<<<<<<<<<<<<<
 *         tau0 = TR / (Omega * ntestpop)
 *         return ntestpop, tau0
 */
    __pyx_t_19 = __pyx_v_nClassUwoN;
    __pyx_t_20 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_19 * __pyx_v_test_freq.strides[0]) )));
    __pyx_t_21 = __pyx_v_m;
    __pyx_t_22 = __pyx_v_m;
    __pyx_v_ntestpop = (__pyx_v_ntestpop + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_20 * __pyx_v_parameters.strides[0]) ) + __pyx_t_21 * __pyx_v_parameters.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_r.data + __pyx_t_22 * __pyx_v_r.strides[0]) )))));
  }

  /* "pyross/inference.pyx":5029
 *                 ntestpop += parameters[test_freq[i], m] * x[i*M+m]
 *             ntestpop += parameters[test_freq[nClassUwoN], m] * r[m]
 *         tau0 = TR / (Omega * ntestpop)             # <<<<<<<<<<<<<<
 *         return ntestpop, tau0
 * 
 */
  __pyx_v_tau0 = (__pyx_v_TR / (__pyx_v_Omega * __pyx_v_ntestpop));

  /* "pyross/inference.pyx":5030
 *             ntestpop += parameters[test_freq[nClassUwoN], m] * r[m]
 *         tau0 = TR / (Omega * ntestpop)
 *         return ntestpop, tau0             # <<<<<<<<<<<<<<
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_ntestpop); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_tau0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
  __pyx_t_8 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pyross/inference.pyx":5012
 *         return (dev/eps)**2 + (dev/eps)**8
 * 
 *     cdef calculate_test_r(self, double [:] x, double [:] r, double TR):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN, M=self.M
 */

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.calculate_test_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_test_freq, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_parameters, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_r, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5032
 *         return ntestpop, tau0
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 */

static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_t, struct __pyx_opt_args_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix *__pyx_optional_args) {

  /* "pyross/inference.pyx":5033
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                         b_matrix=True, jacobian=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, M=self.M
 */
  PyObject *__pyx_v_b_matrix = ((PyObject *)Py_True);
  PyObject *__pyx_v_jacobian = ((PyObject *)Py_False);
  Py_ssize_t __pyx_v_nClass;
  Py_ssize_t __pyx_v_nClassU;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_num_of_infection_terms;
  __Pyx_memviewslice __pyx_v_l = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_TR;
  double __pyx_v_ntestpop;
  double __pyx_v_tau0;
  __Pyx_memviewslice __pyx_v_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_8;
  int __pyx_t_9;
  double __pyx_t_10;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  double __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("compute_jacobian_and_b_matrix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_b_matrix = __pyx_optional_args->b_matrix;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_jacobian = __pyx_optional_args->jacobian;
      }
    }
  }

  /* "pyross/inference.pyx":5035
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, M=self.M             # <<<<<<<<<<<<<<
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.nClass;
  __pyx_v_nClass = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassU;
  __pyx_v_nClassU = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":5036
 *         cdef:
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, M=self.M
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]             # <<<<<<<<<<<<<<
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 *             double [:] fi=self.fi
 */
  __pyx_v_num_of_infection_terms = (__pyx_v_self->infection_terms->dimensions[0]);

  /* "pyross/inference.pyx":5037
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, M=self.M
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             double [:] fi=self.fi
 *             double TR
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_num_of_infection_terms); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 5037, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_l = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":5038
 *             Py_ssize_t num_of_infection_terms=self.infection_terms.shape[0]
 *             double [:, :] l=np.zeros((num_of_infection_terms, self.M), dtype=DTYPE)
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 *             double TR
 *             double ntestpop, tau0
 */
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 5038, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "pyross/inference.pyx":5041
 *             double TR
 *             double ntestpop, tau0
 *             double [:] r=np.zeros(self.M, dtype=DTYPE)             # <<<<<<<<<<<<<<
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 5041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_r = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "pyross/inference.pyx":5042
 *             double ntestpop, tau0
 *             double [:] r=np.zeros(self.M, dtype=DTYPE)
 *         self.CM = self.contactMatrix(t)             # <<<<<<<<<<<<<<
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __pyx_t_4 = __pyx_v_self->__pyx_base.contactMatrix; __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5042, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __pyx_v_self->__pyx_base.CM = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyross/inference.pyx":5043
 *             double [:] r=np.zeros(self.M, dtype=DTYPE)
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(t)
 *         TR = self.testRate(t)
 */
  __pyx_t_8 = (__pyx_v_self->time_dep_param_mapping != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":5044
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)             # <<<<<<<<<<<<<<
 *         TR = self.testRate(t)
 *         if self.constant_terms.size > 0:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_time_dep_model_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyross/inference.pyx":5043
 *             double [:] r=np.zeros(self.M, dtype=DTYPE)
 *         self.CM = self.contactMatrix(t)
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.set_time_dep_model_parameters(t)
 *         TR = self.testRate(t)
 */
  }

  /* "pyross/inference.pyx":5045
 *         if self.time_dep_param_mapping is not None:
 *             self.set_time_dep_model_parameters(t)
 *         TR = self.testRate(t)             # <<<<<<<<<<<<<<
 *         if self.constant_terms.size > 0:
 *             fi = x[(nClassU-1)*M:]
 */
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __pyx_t_2 = __pyx_v_self->testRate; __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5045, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_TR = __pyx_t_10;

  /* "pyross/inference.pyx":5046
 *             self.set_time_dep_model_parameters(t)
 *         TR = self.testRate(t)
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             fi = x[(nClassU-1)*M:]
 *         self.fill_lambdas(x, l)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5046, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 5046, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":5047
 *         TR = self.testRate(t)
 *         if self.constant_terms.size > 0:
 *             fi = x[(nClassU-1)*M:]             # <<<<<<<<<<<<<<
 *         self.fill_lambdas(x, l)
 *         ntestpop, tau0 = self.calculate_test_r(x, r, TR)
 */
    __pyx_t_7.data = __pyx_v_x.data;
    __pyx_t_7.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    __pyx_t_11 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_7,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_11,
    ((__pyx_v_nClassU - 1) * __pyx_v_M),
    0,
    0,
    1,
    0,
    0,
    1) < 0))
{
    __PYX_ERR(0, 5047, __pyx_L1_error)
}

__PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
    __pyx_v_fi = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":5046
 *             self.set_time_dep_model_parameters(t)
 *         TR = self.testRate(t)
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             fi = x[(nClassU-1)*M:]
 *         self.fill_lambdas(x, l)
 */
  }

  /* "pyross/inference.pyx":5048
 *         if self.constant_terms.size > 0:
 *             fi = x[(nClassU-1)*M:]
 *         self.fill_lambdas(x, l)             # <<<<<<<<<<<<<<
 *         ntestpop, tau0 = self.calculate_test_r(x, r, TR)
 *         if b_matrix:
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->fill_lambdas(__pyx_v_self, __pyx_v_x, __pyx_v_l); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":5049
 *             fi = x[(nClassU-1)*M:]
 *         self.fill_lambdas(x, l)
 *         ntestpop, tau0 = self.calculate_test_r(x, r, TR)             # <<<<<<<<<<<<<<
 *         if b_matrix:
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->calculate_test_r(__pyx_v_self, __pyx_v_x, __pyx_v_r, __pyx_v_TR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 5049, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_12(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_5), 2) < 0) __PYX_ERR(0, 5049, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 5049, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5049, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5049, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_ntestpop = __pyx_t_10;
  __pyx_v_tau0 = __pyx_t_13;

  /* "pyross/inference.pyx":5050
 *         self.fill_lambdas(x, l)
 *         ntestpop, tau0 = self.calculate_test_r(x, r, TR)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l, r, tau0)
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_b_matrix); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 5050, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":5051
 *         ntestpop, tau0 = self.calculate_test_r(x, r, TR)
 *         if b_matrix:
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             self.noise_correlation(x, l, r, tau0)
 *         if jacobian:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_14 = 0;
    __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
    __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5051, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.B);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B));
    __pyx_v_self->__pyx_base.B = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":5052
 *         if b_matrix:
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l, r, tau0)             # <<<<<<<<<<<<<<
 *         if jacobian:
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->noise_correlation(__pyx_v_self, __pyx_v_x, __pyx_v_l, __pyx_v_r, __pyx_v_tau0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyross/inference.pyx":5050
 *         self.fill_lambdas(x, l)
 *         ntestpop, tau0 = self.calculate_test_r(x, r, TR)
 *         if b_matrix:             # <<<<<<<<<<<<<<
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l, r, tau0)
 */
  }

  /* "pyross/inference.pyx":5053
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l, r, tau0)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.jacobian(x, l, r, ntestpop, tau0)
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_jacobian); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 5053, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "pyross/inference.pyx":5054
 *             self.noise_correlation(x, l, r, tau0)
 *         if jacobian:
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)             # <<<<<<<<<<<<<<
 *             self.jacobian(x, l, r, ntestpop, tau0)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_14 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5054, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.J);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J));
    __pyx_v_self->__pyx_base.J = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyross/inference.pyx":5055
 *         if jacobian:
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.jacobian(x, l, r, ntestpop, tau0)             # <<<<<<<<<<<<<<
 * 
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_6pyross_9inference_SppQ_old *)__pyx_v_self->__pyx_base.__pyx_vtab)->jacobian(__pyx_v_self, __pyx_v_x, __pyx_v_l, __pyx_v_r, __pyx_v_ntestpop, __pyx_v_tau0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyross/inference.pyx":5053
 *             self.B = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.noise_correlation(x, l, r, tau0)
 *         if jacobian:             # <<<<<<<<<<<<<<
 *             self.J = np.zeros((nClass, M, nClass, M), dtype=DTYPE)
 *             self.jacobian(x, l, r, ntestpop, tau0)
 */
  }

  /* "pyross/inference.pyx":5032
 *         return ntestpop, tau0
 * 
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,             # <<<<<<<<<<<<<<
 *                                         b_matrix=True, jacobian=False):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.compute_jacobian_and_b_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_l, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_r, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5057
 *             self.jacobian(x, l, r, ntestpop, tau0)
 * 
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_fill_lambdas(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l) {
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_infection_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_infective_index;
  Py_ssize_t __pyx_v_index;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_num_of_infection_terms;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __Pyx_RefNannySetupContext("fill_lambdas", 0);

  /* "pyross/inference.pyx":5059
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):
 *         cdef:
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             int [:, :] infection_terms=self.infection_terms
 *             double infection_rate
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 5059, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "pyross/inference.pyx":5060
 *         cdef:
 *             double [:, :] CM=self.CM
 *             int [:, :] infection_terms=self.infection_terms             # <<<<<<<<<<<<<<
 *             double infection_rate
 *             double [:] fi=self.fi
 */
  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->infection_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 5060, __pyx_L1_error)
  __pyx_v_infection_terms = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;

  /* "pyross/inference.pyx":5062
 *             int [:, :] infection_terms=self.infection_terms
 *             double infection_rate
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]
 *         for i in range(num_of_infection_terms):
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 5062, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":5063
 *             double infection_rate
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]             # <<<<<<<<<<<<<<
 *         for i in range(num_of_infection_terms):
 *             infective_index = infection_terms[i, 1]
 */
  __pyx_t_4 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_4;
  __pyx_v_num_of_infection_terms = (__pyx_v_infection_terms.shape[0]);

  /* "pyross/inference.pyx":5064
 *             double [:] fi=self.fi
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]
 *         for i in range(num_of_infection_terms):             # <<<<<<<<<<<<<<
 *             infective_index = infection_terms[i, 1]
 *             for m in range(M):
 */
  __pyx_t_4 = __pyx_v_num_of_infection_terms;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pyross/inference.pyx":5065
 *             Py_ssize_t m, n, i, infective_index, index, M=self.M, num_of_infection_terms=infection_terms.shape[0]
 *         for i in range(num_of_infection_terms):
 *             infective_index = infection_terms[i, 1]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 for n in range(M):
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = 1;
    __pyx_v_infective_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_7 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_8 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5066
 *         for i in range(num_of_infection_terms):
 *             infective_index = infection_terms[i, 1]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 for n in range(M):
 *                     index = n + M*infective_index
 */
    __pyx_t_9 = __pyx_v_M;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_m = __pyx_t_11;

      /* "pyross/inference.pyx":5067
 *             infective_index = infection_terms[i, 1]
 *             for m in range(M):
 *                 for n in range(M):             # <<<<<<<<<<<<<<
 *                     index = n + M*infective_index
 *                     if fi[n]>0:
 */
      __pyx_t_12 = __pyx_v_M;
      __pyx_t_13 = __pyx_t_12;
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
        __pyx_v_n = __pyx_t_14;

        /* "pyross/inference.pyx":5068
 *             for m in range(M):
 *                 for n in range(M):
 *                     index = n + M*infective_index             # <<<<<<<<<<<<<<
 *                     if fi[n]>0:
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 */
        __pyx_v_index = (__pyx_v_n + (__pyx_v_M * __pyx_v_infective_index));

        /* "pyross/inference.pyx":5069
 *                 for n in range(M):
 *                     index = n + M*infective_index
 *                     if fi[n]>0:             # <<<<<<<<<<<<<<
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 */
        __pyx_t_15 = __pyx_v_n;
        __pyx_t_16 = (((*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_15 * __pyx_v_fi.strides[0]) ))) > 0.0) != 0);
        if (__pyx_t_16) {

          /* "pyross/inference.pyx":5070
 *                     index = n + M*infective_index
 *                     if fi[n]>0:
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]             # <<<<<<<<<<<<<<
 * 
 *     cdef jacobian(self, double [:] x, double [:, :] l, double [:] r, double ntestpop, double tau0):
 */
          __pyx_t_17 = __pyx_v_m;
          __pyx_t_18 = __pyx_v_n;
          __pyx_t_19 = __pyx_v_index;
          __pyx_t_20 = __pyx_v_n;
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_22 = __pyx_v_m;
          *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_21 * __pyx_v_l.strides[0]) ) + __pyx_t_22 * __pyx_v_l.strides[1]) )) += (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_17 * __pyx_v_CM.strides[0]) ) + __pyx_t_18 * __pyx_v_CM.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_19 * __pyx_v_x.strides[0]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_20 * __pyx_v_fi.strides[0]) ))));

          /* "pyross/inference.pyx":5069
 *                 for n in range(M):
 *                     index = n + M*infective_index
 *                     if fi[n]>0:             # <<<<<<<<<<<<<<
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 */
        }
      }
    }
  }

  /* "pyross/inference.pyx":5057
 *             self.jacobian(x, l, r, ntestpop, tau0)
 * 
 *     cdef fill_lambdas(self, double [:] x, double [:, :] l):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double [:, :] CM=self.CM
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.fill_lambdas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_infection_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5072
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 *     cdef jacobian(self, double [:] x, double [:, :] l, double [:] r, double ntestpop, double tau0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 */

static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_jacobian(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_r, double __pyx_v_ntestpop, double __pyx_v_tau0) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_dim;
  Py_ssize_t __pyx_v_nClass;
  Py_ssize_t __pyx_v_nClassU;
  Py_ssize_t __pyx_v_nClassUwoN;
  Py_ssize_t __pyx_v_rate_index;
  Py_ssize_t __pyx_v_infective_index;
  Py_ssize_t __pyx_v_product_index;
  Py_ssize_t __pyx_v_reagent_index;
  Py_ssize_t __pyx_v_S_index;
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_linear_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_infection_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_test_pos = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_test_freq = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_rate = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_term;
  double __pyx_v_term2;
  double __pyx_v_term3;
  __Pyx_memviewslice __pyx_v_fi = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_j;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  PyObject *__pyx_t_124 = NULL;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  Py_ssize_t __pyx_t_138;
  Py_ssize_t __pyx_t_139;
  Py_ssize_t __pyx_t_140;
  Py_ssize_t __pyx_t_141;
  Py_ssize_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  Py_ssize_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  Py_ssize_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  Py_ssize_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  Py_ssize_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  Py_ssize_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  Py_ssize_t __pyx_t_154;
  Py_ssize_t __pyx_t_155;
  Py_ssize_t __pyx_t_156;
  Py_ssize_t __pyx_t_157;
  Py_ssize_t __pyx_t_158;
  Py_ssize_t __pyx_t_159;
  Py_ssize_t __pyx_t_160;
  Py_ssize_t __pyx_t_161;
  Py_ssize_t __pyx_t_162;
  Py_ssize_t __pyx_t_163;
  Py_ssize_t __pyx_t_164;
  Py_ssize_t __pyx_t_165;
  Py_ssize_t __pyx_t_166;
  Py_ssize_t __pyx_t_167;
  Py_ssize_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  Py_ssize_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  Py_ssize_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  Py_ssize_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  Py_ssize_t __pyx_t_176;
  Py_ssize_t __pyx_t_177;
  Py_ssize_t __pyx_t_178;
  Py_ssize_t __pyx_t_179;
  Py_ssize_t __pyx_t_180;
  Py_ssize_t __pyx_t_181;
  Py_ssize_t __pyx_t_182;
  Py_ssize_t __pyx_t_183;
  Py_ssize_t __pyx_t_184;
  Py_ssize_t __pyx_t_185;
  Py_ssize_t __pyx_t_186;
  Py_ssize_t __pyx_t_187;
  Py_ssize_t __pyx_t_188;
  PyObject *__pyx_t_189 = NULL;
  PyObject *__pyx_t_190 = NULL;
  PyObject *__pyx_t_191 = NULL;
  __Pyx_RefNannySetupContext("jacobian", 0);

  /* "pyross/inference.pyx":5074
 *     cdef jacobian(self, double [:] x, double [:, :] l, double [:] r, double ntestpop, double tau0):
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim             # <<<<<<<<<<<<<<
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->__pyx_base.dim;
  __pyx_v_dim = __pyx_t_1;

  /* "pyross/inference.pyx":5075
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN             # <<<<<<<<<<<<<<
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             double [:, :, :, :] J = self.J
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.nClass;
  __pyx_v_nClass = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassU;
  __pyx_v_nClassU = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassUwoN;
  __pyx_v_nClassUwoN = __pyx_t_1;

  /* "pyross/inference.pyx":5076
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 */
  if (unlikely(__pyx_v_self->__pyx_base.class_index_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 5076, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base.class_index_dict, __pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 5076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_S_index = __pyx_t_1;

  /* "pyross/inference.pyx":5077
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             double [:, :, :, :] J = self.J             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.J), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 5077, __pyx_L1_error)
  __pyx_v_J = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":5078
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 5078, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":5079
 *             double [:, :, :, :] J = self.J
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters             # <<<<<<<<<<<<<<
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:] test_pos=self.test_pos
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->model_parameters), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 5079, __pyx_L1_error)
  __pyx_v_parameters = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":5080
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms             # <<<<<<<<<<<<<<
 *             int [:] test_pos=self.test_pos
 *             int [:] test_freq=self.test_freq
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->linear_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 5080, __pyx_L1_error)
  __pyx_v_linear_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->infection_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 5080, __pyx_L1_error)
  __pyx_v_infection_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":5081
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:] test_pos=self.test_pos             # <<<<<<<<<<<<<<
 *             int [:] test_freq=self.test_freq
 *             double [:] rate
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_v_self->test_pos), PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 5081, __pyx_L1_error)
  __pyx_v_test_pos = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":5082
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:] test_pos=self.test_pos
 *             int [:] test_freq=self.test_freq             # <<<<<<<<<<<<<<
 *             double [:] rate
 *             double term, term2, term3
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_v_self->test_freq), PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 5082, __pyx_L1_error)
  __pyx_v_test_freq = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":5085
 *             double [:] rate
 *             double term, term2, term3
 *             double [:] fi=self.fi             # <<<<<<<<<<<<<<
 * 
 *         # infection terms (no infection terms in Q classes, perfect quarantine)
 */
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_self->__pyx_base.fi), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 5085, __pyx_L1_error)
  __pyx_v_fi = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;

  /* "pyross/inference.pyx":5088
 * 
 *         # infection terms (no infection terms in Q classes, perfect quarantine)
 *         for i in range(infection_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_infection_terms.shape[0]);
  __pyx_t_8 = __pyx_t_1;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "pyross/inference.pyx":5089
 *         # infection terms (no infection terms in Q classes, perfect quarantine)
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]             # <<<<<<<<<<<<<<
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_10 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_11 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5090
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]             # <<<<<<<<<<<<<<
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = 1;
    __pyx_v_infective_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_12 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_13 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5091
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M):
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_15 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_14 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_15 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5092
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 */
    __pyx_t_7.data = __pyx_v_parameters.data;
    __pyx_t_7.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 5092, __pyx_L1_error)
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_7.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":5093
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:
 */
    __pyx_t_16 = __pyx_v_M;
    __pyx_t_17 = __pyx_t_16;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_m = __pyx_t_18;

      /* "pyross/inference.pyx":5094
 *             rate = parameters[rate_index]
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 */
      __pyx_t_19 = __pyx_v_m;
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_m;
      __pyx_t_22 = __pyx_v_S_index;
      __pyx_t_23 = __pyx_v_m;
      __pyx_t_24 = __pyx_v_S_index;
      __pyx_t_25 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_22 * __pyx_v_J.strides[0]) ) + __pyx_t_23 * __pyx_v_J.strides[1]) ) + __pyx_t_24 * __pyx_v_J.strides[2]) ) + __pyx_t_25 * __pyx_v_J.strides[3]) )) -= ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_19 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_20 * __pyx_v_l.strides[0]) ) + __pyx_t_21 * __pyx_v_l.strides[1]) ))));

      /* "pyross/inference.pyx":5095
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):
 */
      __pyx_t_26 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_26) {

        /* "pyross/inference.pyx":5096
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]             # <<<<<<<<<<<<<<
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 */
        __pyx_t_27 = __pyx_v_m;
        __pyx_t_28 = __pyx_v_i;
        __pyx_t_29 = __pyx_v_m;
        __pyx_t_30 = __pyx_v_product_index;
        __pyx_t_31 = __pyx_v_m;
        __pyx_t_32 = __pyx_v_S_index;
        __pyx_t_33 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_30 * __pyx_v_J.strides[0]) ) + __pyx_t_31 * __pyx_v_J.strides[1]) ) + __pyx_t_32 * __pyx_v_J.strides[2]) ) + __pyx_t_33 * __pyx_v_J.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_27 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_28 * __pyx_v_l.strides[0]) ) + __pyx_t_29 * __pyx_v_l.strides[1]) ))));

        /* "pyross/inference.pyx":5095
 *             for m in range(M):
 *                 J[S_index, m, S_index, m] -= rate[m]*l[i, m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):
 */
      }

      /* "pyross/inference.pyx":5097
 *                 if product_index>-1:
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):             # <<<<<<<<<<<<<<
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:
 */
      __pyx_t_34 = __pyx_v_M;
      __pyx_t_35 = __pyx_t_34;
      for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_35; __pyx_t_36+=1) {
        __pyx_v_n = __pyx_t_36;

        /* "pyross/inference.pyx":5098
 *                     J[product_index, m, S_index, m] += rate[m]*l[i, m]
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *                     if product_index>-1:
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 */
        __pyx_t_37 = ((__pyx_v_S_index * __pyx_v_M) + __pyx_v_m);
        __pyx_t_38 = __pyx_v_m;
        __pyx_t_39 = __pyx_v_m;
        __pyx_t_40 = __pyx_v_n;
        __pyx_t_41 = __pyx_v_n;
        __pyx_t_42 = __pyx_v_S_index;
        __pyx_t_43 = __pyx_v_m;
        __pyx_t_44 = __pyx_v_infective_index;
        __pyx_t_45 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_42 * __pyx_v_J.strides[0]) ) + __pyx_t_43 * __pyx_v_J.strides[1]) ) + __pyx_t_44 * __pyx_v_J.strides[2]) ) + __pyx_t_45 * __pyx_v_J.strides[3]) )) -= ((((*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_37 * __pyx_v_x.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_38 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_39 * __pyx_v_CM.strides[0]) ) + __pyx_t_40 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_41 * __pyx_v_fi.strides[0]) ))));

        /* "pyross/inference.pyx":5099
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *         # linear terms
 */
        __pyx_t_26 = ((__pyx_v_product_index > -1L) != 0);
        if (__pyx_t_26) {

          /* "pyross/inference.pyx":5100
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]             # <<<<<<<<<<<<<<
 *         # linear terms
 *         for i in range(linear_terms.shape[0]):
 */
          __pyx_t_46 = ((__pyx_v_S_index * __pyx_v_M) + __pyx_v_m);
          __pyx_t_47 = __pyx_v_m;
          __pyx_t_48 = __pyx_v_m;
          __pyx_t_49 = __pyx_v_n;
          __pyx_t_50 = __pyx_v_n;
          __pyx_t_51 = __pyx_v_product_index;
          __pyx_t_52 = __pyx_v_m;
          __pyx_t_53 = __pyx_v_infective_index;
          __pyx_t_54 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_51 * __pyx_v_J.strides[0]) ) + __pyx_t_52 * __pyx_v_J.strides[1]) ) + __pyx_t_53 * __pyx_v_J.strides[2]) ) + __pyx_t_54 * __pyx_v_J.strides[3]) )) += ((((*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_46 * __pyx_v_x.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_47 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_CM.data + __pyx_t_48 * __pyx_v_CM.strides[0]) ) + __pyx_t_49 * __pyx_v_CM.strides[1]) )))) / (*((double *) ( /* dim=0 */ (__pyx_v_fi.data + __pyx_t_50 * __pyx_v_fi.strides[0]) ))));

          /* "pyross/inference.pyx":5099
 *                 for n in range(M):
 *                     J[S_index, m, infective_index, n] -= x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *                     if product_index>-1:             # <<<<<<<<<<<<<<
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *         # linear terms
 */
        }
      }
    }
  }

  /* "pyross/inference.pyx":5102
 *                         J[product_index, m, infective_index, n] += x[S_index*M+m]*rate[m]*CM[m, n]/fi[n]
 *         # linear terms
 *         for i in range(linear_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_linear_terms.shape[0]);
  __pyx_t_8 = __pyx_t_1;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "pyross/inference.pyx":5103
 *         # linear terms
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]             # <<<<<<<<<<<<<<
 *             reagent_index = linear_terms[i, 1]
 *             rate_index = linear_terms[i, 0]
 */
    __pyx_t_55 = __pyx_v_i;
    __pyx_t_56 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_55 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_56 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":5104
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]             # <<<<<<<<<<<<<<
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_57 = __pyx_v_i;
    __pyx_t_58 = 1;
    __pyx_v_reagent_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_57 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_58 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":5105
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 *             rate_index = linear_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M):
 */
    __pyx_t_59 = __pyx_v_i;
    __pyx_t_60 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_59 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_60 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":5106
 *             reagent_index = linear_terms[i, 1]
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 */
    __pyx_t_7.data = __pyx_v_parameters.data;
    __pyx_t_7.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 5106, __pyx_L1_error)
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_7.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_7;
    __pyx_t_7.memview = NULL;
    __pyx_t_7.data = NULL;

    /* "pyross/inference.pyx":5107
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 J[reagent_index + nClassU, m, reagent_index + nClassU, m] -= rate[m]
 */
    __pyx_t_16 = __pyx_v_M;
    __pyx_t_17 = __pyx_t_16;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_m = __pyx_t_18;

      /* "pyross/inference.pyx":5108
 *             rate = parameters[rate_index]
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]             # <<<<<<<<<<<<<<
 *                 J[reagent_index + nClassU, m, reagent_index + nClassU, m] -= rate[m]
 *                 if product_index>-1:
 */
      __pyx_t_61 = __pyx_v_m;
      __pyx_t_62 = __pyx_v_reagent_index;
      __pyx_t_63 = __pyx_v_m;
      __pyx_t_64 = __pyx_v_reagent_index;
      __pyx_t_65 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_62 * __pyx_v_J.strides[0]) ) + __pyx_t_63 * __pyx_v_J.strides[1]) ) + __pyx_t_64 * __pyx_v_J.strides[2]) ) + __pyx_t_65 * __pyx_v_J.strides[3]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_61 * __pyx_v_rate.strides[0]) )));

      /* "pyross/inference.pyx":5109
 *             for m in range(M):
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 J[reagent_index + nClassU, m, reagent_index + nClassU, m] -= rate[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     J[product_index, m, reagent_index, m] += rate[m]
 */
      __pyx_t_66 = __pyx_v_m;
      __pyx_t_67 = (__pyx_v_reagent_index + __pyx_v_nClassU);
      __pyx_t_68 = __pyx_v_m;
      __pyx_t_69 = (__pyx_v_reagent_index + __pyx_v_nClassU);
      __pyx_t_70 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_67 * __pyx_v_J.strides[0]) ) + __pyx_t_68 * __pyx_v_J.strides[1]) ) + __pyx_t_69 * __pyx_v_J.strides[2]) ) + __pyx_t_70 * __pyx_v_J.strides[3]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_66 * __pyx_v_rate.strides[0]) )));

      /* "pyross/inference.pyx":5110
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 J[reagent_index + nClassU, m, reagent_index + nClassU, m] -= rate[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, reagent_index, m] += rate[m]
 *                     J[product_index + nClassU, m, reagent_index + nClassU, m] += rate[m]
 */
      __pyx_t_26 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_26) {

        /* "pyross/inference.pyx":5111
 *                 J[reagent_index + nClassU, m, reagent_index + nClassU, m] -= rate[m]
 *                 if product_index>-1:
 *                     J[product_index, m, reagent_index, m] += rate[m]             # <<<<<<<<<<<<<<
 *                     J[product_index + nClassU, m, reagent_index + nClassU, m] += rate[m]
 *         # quarantining terms
 */
        __pyx_t_71 = __pyx_v_m;
        __pyx_t_72 = __pyx_v_product_index;
        __pyx_t_73 = __pyx_v_m;
        __pyx_t_74 = __pyx_v_reagent_index;
        __pyx_t_75 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_72 * __pyx_v_J.strides[0]) ) + __pyx_t_73 * __pyx_v_J.strides[1]) ) + __pyx_t_74 * __pyx_v_J.strides[2]) ) + __pyx_t_75 * __pyx_v_J.strides[3]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_71 * __pyx_v_rate.strides[0]) )));

        /* "pyross/inference.pyx":5112
 *                 if product_index>-1:
 *                     J[product_index, m, reagent_index, m] += rate[m]
 *                     J[product_index + nClassU, m, reagent_index + nClassU, m] += rate[m]             # <<<<<<<<<<<<<<
 *         # quarantining terms
 *         for m in range(M):
 */
        __pyx_t_76 = __pyx_v_m;
        __pyx_t_77 = (__pyx_v_product_index + __pyx_v_nClassU);
        __pyx_t_78 = __pyx_v_m;
        __pyx_t_79 = (__pyx_v_reagent_index + __pyx_v_nClassU);
        __pyx_t_80 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_77 * __pyx_v_J.strides[0]) ) + __pyx_t_78 * __pyx_v_J.strides[1]) ) + __pyx_t_79 * __pyx_v_J.strides[2]) ) + __pyx_t_80 * __pyx_v_J.strides[3]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_76 * __pyx_v_rate.strides[0]) )));

        /* "pyross/inference.pyx":5110
 *                 J[reagent_index, m, reagent_index, m] -= rate[m]
 *                 J[reagent_index + nClassU, m, reagent_index + nClassU, m] -= rate[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     J[product_index, m, reagent_index, m] += rate[m]
 *                     J[product_index + nClassU, m, reagent_index + nClassU, m] += rate[m]
 */
      }
    }
  }

  /* "pyross/inference.pyx":5114
 *                     J[product_index + nClassU, m, reagent_index + nClassU, m] += rate[m]
 *         # quarantining terms
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for i in range(nClassUwoN):
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_8 = __pyx_t_1;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_m = __pyx_t_9;

    /* "pyross/inference.pyx":5115
 *         # quarantining terms
 *         for m in range(M):
 *             for i in range(nClassUwoN):             # <<<<<<<<<<<<<<
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m]
 *                 term2 = term * x[i*M+m] / ntestpop
 */
    __pyx_t_16 = __pyx_v_nClassUwoN;
    __pyx_t_17 = __pyx_t_16;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_i = __pyx_t_18;

      /* "pyross/inference.pyx":5116
 *         for m in range(M):
 *             for i in range(nClassUwoN):
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m]             # <<<<<<<<<<<<<<
 *                 term2 = term * x[i*M+m] / ntestpop
 *                 J[i, m, i, m] -= term
 */
      __pyx_t_81 = __pyx_v_i;
      __pyx_t_82 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_81 * __pyx_v_test_freq.strides[0]) )));
      __pyx_t_83 = __pyx_v_m;
      __pyx_t_84 = __pyx_v_i;
      __pyx_t_85 = (*((int *) ( /* dim=0 */ (__pyx_v_test_pos.data + __pyx_t_84 * __pyx_v_test_pos.strides[0]) )));
      __pyx_t_86 = __pyx_v_m;
      __pyx_v_term = ((__pyx_v_tau0 * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_82 * __pyx_v_parameters.strides[0]) ) + __pyx_t_83 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_85 * __pyx_v_parameters.strides[0]) ) + __pyx_t_86 * __pyx_v_parameters.strides[1]) ))));

      /* "pyross/inference.pyx":5117
 *             for i in range(nClassUwoN):
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m]
 *                 term2 = term * x[i*M+m] / ntestpop             # <<<<<<<<<<<<<<
 *                 J[i, m, i, m] -= term
 *                 J[i+nClassU, m, i, m] += term
 */
      __pyx_t_87 = ((__pyx_v_i * __pyx_v_M) + __pyx_v_m);
      __pyx_v_term2 = ((__pyx_v_term * (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_87 * __pyx_v_x.strides[0]) )))) / __pyx_v_ntestpop);

      /* "pyross/inference.pyx":5118
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m]
 *                 term2 = term * x[i*M+m] / ntestpop
 *                 J[i, m, i, m] -= term             # <<<<<<<<<<<<<<
 *                 J[i+nClassU, m, i, m] += term
 *                 J[nClass-1,  m, i, m] += term
 */
      __pyx_t_88 = __pyx_v_i;
      __pyx_t_89 = __pyx_v_m;
      __pyx_t_90 = __pyx_v_i;
      __pyx_t_91 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_88 * __pyx_v_J.strides[0]) ) + __pyx_t_89 * __pyx_v_J.strides[1]) ) + __pyx_t_90 * __pyx_v_J.strides[2]) ) + __pyx_t_91 * __pyx_v_J.strides[3]) )) -= __pyx_v_term;

      /* "pyross/inference.pyx":5119
 *                 term2 = term * x[i*M+m] / ntestpop
 *                 J[i, m, i, m] -= term
 *                 J[i+nClassU, m, i, m] += term             # <<<<<<<<<<<<<<
 *                 J[nClass-1,  m, i, m] += term
 *                 for n in range(M):
 */
      __pyx_t_92 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_93 = __pyx_v_m;
      __pyx_t_94 = __pyx_v_i;
      __pyx_t_95 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_92 * __pyx_v_J.strides[0]) ) + __pyx_t_93 * __pyx_v_J.strides[1]) ) + __pyx_t_94 * __pyx_v_J.strides[2]) ) + __pyx_t_95 * __pyx_v_J.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5120
 *                 J[i, m, i, m] -= term
 *                 J[i+nClassU, m, i, m] += term
 *                 J[nClass-1,  m, i, m] += term             # <<<<<<<<<<<<<<
 *                 for n in range(M):
 *                     for j in range(nClassUwoN):
 */
      __pyx_t_96 = (__pyx_v_nClass - 1);
      __pyx_t_97 = __pyx_v_m;
      __pyx_t_98 = __pyx_v_i;
      __pyx_t_99 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_96 * __pyx_v_J.strides[0]) ) + __pyx_t_97 * __pyx_v_J.strides[1]) ) + __pyx_t_98 * __pyx_v_J.strides[2]) ) + __pyx_t_99 * __pyx_v_J.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5121
 *                 J[i+nClassU, m, i, m] += term
 *                 J[nClass-1,  m, i, m] += term
 *                 for n in range(M):             # <<<<<<<<<<<<<<
 *                     for j in range(nClassUwoN):
 *                         term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 */
      __pyx_t_34 = __pyx_v_M;
      __pyx_t_35 = __pyx_t_34;
      for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_35; __pyx_t_36+=1) {
        __pyx_v_n = __pyx_t_36;

        /* "pyross/inference.pyx":5122
 *                 J[nClass-1,  m, i, m] += term
 *                 for n in range(M):
 *                     for j in range(nClassUwoN):             # <<<<<<<<<<<<<<
 *                         term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 *                         J[i, m, j, n] += term3
 */
        __pyx_t_100 = __pyx_v_nClassUwoN;
        __pyx_t_101 = __pyx_t_100;
        for (__pyx_t_102 = 0; __pyx_t_102 < __pyx_t_101; __pyx_t_102+=1) {
          __pyx_v_j = __pyx_t_102;

          /* "pyross/inference.pyx":5123
 *                 for n in range(M):
 *                     for j in range(nClassUwoN):
 *                         term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])             # <<<<<<<<<<<<<<
 *                         J[i, m, j, n] += term3
 *                         J[i+nClassU, m, j, n] -= term3
 */
          __pyx_t_103 = __pyx_v_j;
          __pyx_t_104 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_103 * __pyx_v_test_freq.strides[0]) )));
          __pyx_t_105 = __pyx_v_n;
          __pyx_t_106 = __pyx_v_nClassUwoN;
          __pyx_t_107 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_106 * __pyx_v_test_freq.strides[0]) )));
          __pyx_t_108 = __pyx_v_n;
          __pyx_v_term3 = (__pyx_v_term2 * ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_104 * __pyx_v_parameters.strides[0]) ) + __pyx_t_105 * __pyx_v_parameters.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_107 * __pyx_v_parameters.strides[0]) ) + __pyx_t_108 * __pyx_v_parameters.strides[1]) )))));

          /* "pyross/inference.pyx":5124
 *                     for j in range(nClassUwoN):
 *                         term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 *                         J[i, m, j, n] += term3             # <<<<<<<<<<<<<<
 *                         J[i+nClassU, m, j, n] -= term3
 *                         J[nClass-1,  m, j, n] -= term3
 */
          __pyx_t_109 = __pyx_v_i;
          __pyx_t_110 = __pyx_v_m;
          __pyx_t_111 = __pyx_v_j;
          __pyx_t_112 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_109 * __pyx_v_J.strides[0]) ) + __pyx_t_110 * __pyx_v_J.strides[1]) ) + __pyx_t_111 * __pyx_v_J.strides[2]) ) + __pyx_t_112 * __pyx_v_J.strides[3]) )) += __pyx_v_term3;

          /* "pyross/inference.pyx":5125
 *                         term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 *                         J[i, m, j, n] += term3
 *                         J[i+nClassU, m, j, n] -= term3             # <<<<<<<<<<<<<<
 *                         J[nClass-1,  m, j, n] -= term3
 *                     term3 = term2 * parameters[test_freq[nClassUwoN],n]
 */
          __pyx_t_113 = (__pyx_v_i + __pyx_v_nClassU);
          __pyx_t_114 = __pyx_v_m;
          __pyx_t_115 = __pyx_v_j;
          __pyx_t_116 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_113 * __pyx_v_J.strides[0]) ) + __pyx_t_114 * __pyx_v_J.strides[1]) ) + __pyx_t_115 * __pyx_v_J.strides[2]) ) + __pyx_t_116 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;

          /* "pyross/inference.pyx":5126
 *                         J[i, m, j, n] += term3
 *                         J[i+nClassU, m, j, n] -= term3
 *                         J[nClass-1,  m, j, n] -= term3             # <<<<<<<<<<<<<<
 *                     term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                     if self.constant_terms.size > 0:
 */
          __pyx_t_117 = (__pyx_v_nClass - 1);
          __pyx_t_118 = __pyx_v_m;
          __pyx_t_119 = __pyx_v_j;
          __pyx_t_120 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_117 * __pyx_v_J.strides[0]) ) + __pyx_t_118 * __pyx_v_J.strides[1]) ) + __pyx_t_119 * __pyx_v_J.strides[2]) ) + __pyx_t_120 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;
        }

        /* "pyross/inference.pyx":5127
 *                         J[i+nClassU, m, j, n] -= term3
 *                         J[nClass-1,  m, j, n] -= term3
 *                     term3 = term2 * parameters[test_freq[nClassUwoN],n]             # <<<<<<<<<<<<<<
 *                     if self.constant_terms.size > 0:
 *                         J[i, m, nClassUwoN, n] += term3
 */
        __pyx_t_121 = __pyx_v_nClassUwoN;
        __pyx_t_122 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_121 * __pyx_v_test_freq.strides[0]) )));
        __pyx_t_123 = __pyx_v_n;
        __pyx_v_term3 = (__pyx_v_term2 * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_122 * __pyx_v_parameters.strides[0]) ) + __pyx_t_123 * __pyx_v_parameters.strides[1]) ))));

        /* "pyross/inference.pyx":5128
 *                         J[nClass-1,  m, j, n] -= term3
 *                     term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                     if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *                         J[i, m, nClassUwoN, n] += term3
 *                         J[i+nClassU, m, nClassUwoN, n] -= term3
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_124 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_124); if (unlikely(!__pyx_t_124)) __PYX_ERR(0, 5128, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_124); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 5128, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_124); __pyx_t_124 = 0;
        if (__pyx_t_26) {

          /* "pyross/inference.pyx":5129
 *                     term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                     if self.constant_terms.size > 0:
 *                         J[i, m, nClassUwoN, n] += term3             # <<<<<<<<<<<<<<
 *                         J[i+nClassU, m, nClassUwoN, n] -= term3
 *                         J[nClass-1,  m, nClassUwoN, n] -= term3
 */
          __pyx_t_125 = __pyx_v_i;
          __pyx_t_126 = __pyx_v_m;
          __pyx_t_127 = __pyx_v_nClassUwoN;
          __pyx_t_128 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_125 * __pyx_v_J.strides[0]) ) + __pyx_t_126 * __pyx_v_J.strides[1]) ) + __pyx_t_127 * __pyx_v_J.strides[2]) ) + __pyx_t_128 * __pyx_v_J.strides[3]) )) += __pyx_v_term3;

          /* "pyross/inference.pyx":5130
 *                     if self.constant_terms.size > 0:
 *                         J[i, m, nClassUwoN, n] += term3
 *                         J[i+nClassU, m, nClassUwoN, n] -= term3             # <<<<<<<<<<<<<<
 *                         J[nClass-1,  m, nClassUwoN, n] -= term3
 *                     J[i, m, nClass-1, n] -= term3
 */
          __pyx_t_129 = (__pyx_v_i + __pyx_v_nClassU);
          __pyx_t_130 = __pyx_v_m;
          __pyx_t_131 = __pyx_v_nClassUwoN;
          __pyx_t_132 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_129 * __pyx_v_J.strides[0]) ) + __pyx_t_130 * __pyx_v_J.strides[1]) ) + __pyx_t_131 * __pyx_v_J.strides[2]) ) + __pyx_t_132 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;

          /* "pyross/inference.pyx":5131
 *                         J[i, m, nClassUwoN, n] += term3
 *                         J[i+nClassU, m, nClassUwoN, n] -= term3
 *                         J[nClass-1,  m, nClassUwoN, n] -= term3             # <<<<<<<<<<<<<<
 *                     J[i, m, nClass-1, n] -= term3
 *                     J[i+nClassU, m, nClass-1, n] += term3
 */
          __pyx_t_133 = (__pyx_v_nClass - 1);
          __pyx_t_134 = __pyx_v_m;
          __pyx_t_135 = __pyx_v_nClassUwoN;
          __pyx_t_136 = __pyx_v_n;
          *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_133 * __pyx_v_J.strides[0]) ) + __pyx_t_134 * __pyx_v_J.strides[1]) ) + __pyx_t_135 * __pyx_v_J.strides[2]) ) + __pyx_t_136 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;

          /* "pyross/inference.pyx":5128
 *                         J[nClass-1,  m, j, n] -= term3
 *                     term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                     if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *                         J[i, m, nClassUwoN, n] += term3
 *                         J[i+nClassU, m, nClassUwoN, n] -= term3
 */
        }

        /* "pyross/inference.pyx":5132
 *                         J[i+nClassU, m, nClassUwoN, n] -= term3
 *                         J[nClass-1,  m, nClassUwoN, n] -= term3
 *                     J[i, m, nClass-1, n] -= term3             # <<<<<<<<<<<<<<
 *                     J[i+nClassU, m, nClass-1, n] += term3
 *                     J[nClass-1,  m, nClass-1, n] += term3
 */
        __pyx_t_137 = __pyx_v_i;
        __pyx_t_138 = __pyx_v_m;
        __pyx_t_139 = (__pyx_v_nClass - 1);
        __pyx_t_140 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_137 * __pyx_v_J.strides[0]) ) + __pyx_t_138 * __pyx_v_J.strides[1]) ) + __pyx_t_139 * __pyx_v_J.strides[2]) ) + __pyx_t_140 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;

        /* "pyross/inference.pyx":5133
 *                         J[nClass-1,  m, nClassUwoN, n] -= term3
 *                     J[i, m, nClass-1, n] -= term3
 *                     J[i+nClassU, m, nClass-1, n] += term3             # <<<<<<<<<<<<<<
 *                     J[nClass-1,  m, nClass-1, n] += term3
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m]
 */
        __pyx_t_141 = (__pyx_v_i + __pyx_v_nClassU);
        __pyx_t_142 = __pyx_v_m;
        __pyx_t_143 = (__pyx_v_nClass - 1);
        __pyx_t_144 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_141 * __pyx_v_J.strides[0]) ) + __pyx_t_142 * __pyx_v_J.strides[1]) ) + __pyx_t_143 * __pyx_v_J.strides[2]) ) + __pyx_t_144 * __pyx_v_J.strides[3]) )) += __pyx_v_term3;

        /* "pyross/inference.pyx":5134
 *                     J[i, m, nClass-1, n] -= term3
 *                     J[i+nClassU, m, nClass-1, n] += term3
 *                     J[nClass-1,  m, nClass-1, n] += term3             # <<<<<<<<<<<<<<
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m]
 *             term2 = term * r[m] / ntestpop
 */
        __pyx_t_145 = (__pyx_v_nClass - 1);
        __pyx_t_146 = __pyx_v_m;
        __pyx_t_147 = (__pyx_v_nClass - 1);
        __pyx_t_148 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_145 * __pyx_v_J.strides[0]) ) + __pyx_t_146 * __pyx_v_J.strides[1]) ) + __pyx_t_147 * __pyx_v_J.strides[2]) ) + __pyx_t_148 * __pyx_v_J.strides[3]) )) += __pyx_v_term3;
      }
    }

    /* "pyross/inference.pyx":5135
 *                     J[i+nClassU, m, nClass-1, n] += term3
 *                     J[nClass-1,  m, nClass-1, n] += term3
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m]             # <<<<<<<<<<<<<<
 *             term2 = term * r[m] / ntestpop
 *             for j in range(nClassUwoN):
 */
    __pyx_t_149 = __pyx_v_nClassUwoN;
    __pyx_t_150 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_149 * __pyx_v_test_freq.strides[0]) )));
    __pyx_t_151 = __pyx_v_m;
    __pyx_t_152 = __pyx_v_nClassUwoN;
    __pyx_t_153 = (*((int *) ( /* dim=0 */ (__pyx_v_test_pos.data + __pyx_t_152 * __pyx_v_test_pos.strides[0]) )));
    __pyx_t_154 = __pyx_v_m;
    __pyx_v_term = ((__pyx_v_tau0 * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_150 * __pyx_v_parameters.strides[0]) ) + __pyx_t_151 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_153 * __pyx_v_parameters.strides[0]) ) + __pyx_t_154 * __pyx_v_parameters.strides[1]) ))));

    /* "pyross/inference.pyx":5136
 *                     J[nClass-1,  m, nClass-1, n] += term3
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m]
 *             term2 = term * r[m] / ntestpop             # <<<<<<<<<<<<<<
 *             for j in range(nClassUwoN):
 *                 J[nClass-1, m, j, m] -= term
 */
    __pyx_t_155 = __pyx_v_m;
    __pyx_v_term2 = ((__pyx_v_term * (*((double *) ( /* dim=0 */ (__pyx_v_r.data + __pyx_t_155 * __pyx_v_r.strides[0]) )))) / __pyx_v_ntestpop);

    /* "pyross/inference.pyx":5137
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m]
 *             term2 = term * r[m] / ntestpop
 *             for j in range(nClassUwoN):             # <<<<<<<<<<<<<<
 *                 J[nClass-1, m, j, m] -= term
 *             if self.constant_terms.size > 0:
 */
    __pyx_t_16 = __pyx_v_nClassUwoN;
    __pyx_t_17 = __pyx_t_16;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_j = __pyx_t_18;

      /* "pyross/inference.pyx":5138
 *             term2 = term * r[m] / ntestpop
 *             for j in range(nClassUwoN):
 *                 J[nClass-1, m, j, m] -= term             # <<<<<<<<<<<<<<
 *             if self.constant_terms.size > 0:
 *                 J[nClass-1, m, nClassUwoN, m] += term
 */
      __pyx_t_156 = (__pyx_v_nClass - 1);
      __pyx_t_157 = __pyx_v_m;
      __pyx_t_158 = __pyx_v_j;
      __pyx_t_159 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_156 * __pyx_v_J.strides[0]) ) + __pyx_t_157 * __pyx_v_J.strides[1]) ) + __pyx_t_158 * __pyx_v_J.strides[2]) ) + __pyx_t_159 * __pyx_v_J.strides[3]) )) -= __pyx_v_term;
    }

    /* "pyross/inference.pyx":5139
 *             for j in range(nClassUwoN):
 *                 J[nClass-1, m, j, m] -= term
 *             if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *                 J[nClass-1, m, nClassUwoN, m] += term
 *             J[nClass-1, m, nClass-1, m] -= term
 */
    __pyx_t_124 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_124)) __PYX_ERR(0, 5139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_124);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_124, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5139, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_124); __pyx_t_124 = 0;
    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 5139, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_26) {

      /* "pyross/inference.pyx":5140
 *                 J[nClass-1, m, j, m] -= term
 *             if self.constant_terms.size > 0:
 *                 J[nClass-1, m, nClassUwoN, m] += term             # <<<<<<<<<<<<<<
 *             J[nClass-1, m, nClass-1, m] -= term
 *             for n in range(M):
 */
      __pyx_t_160 = (__pyx_v_nClass - 1);
      __pyx_t_161 = __pyx_v_m;
      __pyx_t_162 = __pyx_v_nClassUwoN;
      __pyx_t_163 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_160 * __pyx_v_J.strides[0]) ) + __pyx_t_161 * __pyx_v_J.strides[1]) ) + __pyx_t_162 * __pyx_v_J.strides[2]) ) + __pyx_t_163 * __pyx_v_J.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5139
 *             for j in range(nClassUwoN):
 *                 J[nClass-1, m, j, m] -= term
 *             if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *                 J[nClass-1, m, nClassUwoN, m] += term
 *             J[nClass-1, m, nClass-1, m] -= term
 */
    }

    /* "pyross/inference.pyx":5141
 *             if self.constant_terms.size > 0:
 *                 J[nClass-1, m, nClassUwoN, m] += term
 *             J[nClass-1, m, nClass-1, m] -= term             # <<<<<<<<<<<<<<
 *             for n in range(M):
 *                 for j in range(nClassUwoN):
 */
    __pyx_t_164 = (__pyx_v_nClass - 1);
    __pyx_t_165 = __pyx_v_m;
    __pyx_t_166 = (__pyx_v_nClass - 1);
    __pyx_t_167 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_164 * __pyx_v_J.strides[0]) ) + __pyx_t_165 * __pyx_v_J.strides[1]) ) + __pyx_t_166 * __pyx_v_J.strides[2]) ) + __pyx_t_167 * __pyx_v_J.strides[3]) )) -= __pyx_v_term;

    /* "pyross/inference.pyx":5142
 *                 J[nClass-1, m, nClassUwoN, m] += term
 *             J[nClass-1, m, nClass-1, m] -= term
 *             for n in range(M):             # <<<<<<<<<<<<<<
 *                 for j in range(nClassUwoN):
 *                     term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 */
    __pyx_t_16 = __pyx_v_M;
    __pyx_t_17 = __pyx_t_16;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_n = __pyx_t_18;

      /* "pyross/inference.pyx":5143
 *             J[nClass-1, m, nClass-1, m] -= term
 *             for n in range(M):
 *                 for j in range(nClassUwoN):             # <<<<<<<<<<<<<<
 *                     term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 *                     J[nClass-1,  m, j, n] -= term3
 */
      __pyx_t_34 = __pyx_v_nClassUwoN;
      __pyx_t_35 = __pyx_t_34;
      for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_35; __pyx_t_36+=1) {
        __pyx_v_j = __pyx_t_36;

        /* "pyross/inference.pyx":5144
 *             for n in range(M):
 *                 for j in range(nClassUwoN):
 *                     term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])             # <<<<<<<<<<<<<<
 *                     J[nClass-1,  m, j, n] -= term3
 *                 term3 = term2 * parameters[test_freq[nClassUwoN],n]
 */
        __pyx_t_168 = __pyx_v_j;
        __pyx_t_169 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_168 * __pyx_v_test_freq.strides[0]) )));
        __pyx_t_170 = __pyx_v_n;
        __pyx_t_171 = __pyx_v_nClassUwoN;
        __pyx_t_172 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_171 * __pyx_v_test_freq.strides[0]) )));
        __pyx_t_173 = __pyx_v_n;
        __pyx_v_term3 = (__pyx_v_term2 * ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_169 * __pyx_v_parameters.strides[0]) ) + __pyx_t_170 * __pyx_v_parameters.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_172 * __pyx_v_parameters.strides[0]) ) + __pyx_t_173 * __pyx_v_parameters.strides[1]) )))));

        /* "pyross/inference.pyx":5145
 *                 for j in range(nClassUwoN):
 *                     term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 *                     J[nClass-1,  m, j, n] -= term3             # <<<<<<<<<<<<<<
 *                 term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                 if self.constant_terms.size > 0:
 */
        __pyx_t_174 = (__pyx_v_nClass - 1);
        __pyx_t_175 = __pyx_v_m;
        __pyx_t_176 = __pyx_v_j;
        __pyx_t_177 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_174 * __pyx_v_J.strides[0]) ) + __pyx_t_175 * __pyx_v_J.strides[1]) ) + __pyx_t_176 * __pyx_v_J.strides[2]) ) + __pyx_t_177 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;
      }

      /* "pyross/inference.pyx":5146
 *                     term3 = term2 * (parameters[test_freq[j],n] - parameters[test_freq[nClassUwoN],n])
 *                     J[nClass-1,  m, j, n] -= term3
 *                 term3 = term2 * parameters[test_freq[nClassUwoN],n]             # <<<<<<<<<<<<<<
 *                 if self.constant_terms.size > 0:
 *                     J[nClass-1,  m, nClassUwoN, n] -= term3
 */
      __pyx_t_178 = __pyx_v_nClassUwoN;
      __pyx_t_179 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_178 * __pyx_v_test_freq.strides[0]) )));
      __pyx_t_180 = __pyx_v_n;
      __pyx_v_term3 = (__pyx_v_term2 * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_179 * __pyx_v_parameters.strides[0]) ) + __pyx_t_180 * __pyx_v_parameters.strides[1]) ))));

      /* "pyross/inference.pyx":5147
 *                     J[nClass-1,  m, j, n] -= term3
 *                 term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                 if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *                     J[nClass-1,  m, nClassUwoN, n] -= term3
 *                 J[nClass-1,  m, nClass-1, n] += term3
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_124 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_124); if (unlikely(!__pyx_t_124)) __PYX_ERR(0, 5147, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_124); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 5147, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_124); __pyx_t_124 = 0;
      if (__pyx_t_26) {

        /* "pyross/inference.pyx":5148
 *                 term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                 if self.constant_terms.size > 0:
 *                     J[nClass-1,  m, nClassUwoN, n] -= term3             # <<<<<<<<<<<<<<
 *                 J[nClass-1,  m, nClass-1, n] += term3
 * 
 */
        __pyx_t_181 = (__pyx_v_nClass - 1);
        __pyx_t_182 = __pyx_v_m;
        __pyx_t_183 = __pyx_v_nClassUwoN;
        __pyx_t_184 = __pyx_v_n;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_181 * __pyx_v_J.strides[0]) ) + __pyx_t_182 * __pyx_v_J.strides[1]) ) + __pyx_t_183 * __pyx_v_J.strides[2]) ) + __pyx_t_184 * __pyx_v_J.strides[3]) )) -= __pyx_v_term3;

        /* "pyross/inference.pyx":5147
 *                     J[nClass-1,  m, j, n] -= term3
 *                 term3 = term2 * parameters[test_freq[nClassUwoN],n]
 *                 if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *                     J[nClass-1,  m, nClassUwoN, n] -= term3
 *                 J[nClass-1,  m, nClass-1, n] += term3
 */
      }

      /* "pyross/inference.pyx":5149
 *                 if self.constant_terms.size > 0:
 *                     J[nClass-1,  m, nClassUwoN, n] -= term3
 *                 J[nClass-1,  m, nClass-1, n] += term3             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_185 = (__pyx_v_nClass - 1);
      __pyx_t_186 = __pyx_v_m;
      __pyx_t_187 = (__pyx_v_nClass - 1);
      __pyx_t_188 = __pyx_v_n;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_185 * __pyx_v_J.strides[0]) ) + __pyx_t_186 * __pyx_v_J.strides[1]) ) + __pyx_t_187 * __pyx_v_J.strides[2]) ) + __pyx_t_188 * __pyx_v_J.strides[3]) )) += __pyx_v_term3;
    }
  }

  /* "pyross/inference.pyx":5153
 * 
 * 
 *         self.J_mat = self.J.reshape((dim, dim))             # <<<<<<<<<<<<<<
 * 
 *     cdef noise_correlation(self, double [:] x, double [:, :] l, double [:] r, double tau0):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.J), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_189 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_189)) __PYX_ERR(0, 5153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_189);
  __pyx_t_190 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 5153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_190);
  __pyx_t_191 = PyTuple_New(2); if (unlikely(!__pyx_t_191)) __PYX_ERR(0, 5153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_191);
  __Pyx_GIVEREF(__pyx_t_189);
  PyTuple_SET_ITEM(__pyx_t_191, 0, __pyx_t_189);
  __Pyx_GIVEREF(__pyx_t_190);
  PyTuple_SET_ITEM(__pyx_t_191, 1, __pyx_t_190);
  __pyx_t_189 = 0;
  __pyx_t_190 = 0;
  __pyx_t_190 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_190 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_190)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_190);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_124 = (__pyx_t_190) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_190, __pyx_t_191) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_191);
  __Pyx_XDECREF(__pyx_t_190); __pyx_t_190 = 0;
  __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
  if (unlikely(!__pyx_t_124)) __PYX_ERR(0, 5153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_124);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_124) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_124, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5153, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_124);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __pyx_v_self->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_124);
  __pyx_t_124 = 0;

  /* "pyross/inference.pyx":5072
 *                         l[i, m] += CM[m,n]*x[index]/fi[n]
 * 
 *     cdef jacobian(self, double [:] x, double [:, :] l, double [:] r, double ntestpop, double tau0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, dim=self.dim
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_124);
  __Pyx_XDECREF(__pyx_t_189);
  __Pyx_XDECREF(__pyx_t_190);
  __Pyx_XDECREF(__pyx_t_191);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_parameters, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_linear_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_infection_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_test_pos, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_test_freq, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_fi, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5155
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] x, double [:, :] l, double [:] r, double tau0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, class_index
 */

static PyObject *__pyx_f_6pyross_9inference_8SppQ_old_noise_correlation(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_l, __Pyx_memviewslice __pyx_v_r, double __pyx_v_tau0) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_M;
  Py_ssize_t __pyx_v_class_index;
  Py_ssize_t __pyx_v_nClass;
  Py_ssize_t __pyx_v_nClassU;
  Py_ssize_t __pyx_v_nClassUwoN;
  Py_ssize_t __pyx_v_rate_index;
  CYTHON_UNUSED Py_ssize_t __pyx_v_infective_index;
  Py_ssize_t __pyx_v_product_index;
  Py_ssize_t __pyx_v_reagent_index;
  Py_ssize_t __pyx_v_S_index;
  __Pyx_memviewslice __pyx_v_B = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_CM = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_constant_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_linear_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_infection_terms = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_test_pos = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_test_freq = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_s = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_reagent = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_rate = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_term;
  double __pyx_v_Omega;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_7;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  Py_ssize_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  Py_ssize_t __pyx_t_138;
  Py_ssize_t __pyx_t_139;
  Py_ssize_t __pyx_t_140;
  Py_ssize_t __pyx_t_141;
  Py_ssize_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  Py_ssize_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  Py_ssize_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  Py_ssize_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  Py_ssize_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  Py_ssize_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  Py_ssize_t __pyx_t_154;
  Py_ssize_t __pyx_t_155;
  Py_ssize_t __pyx_t_156;
  Py_ssize_t __pyx_t_157;
  Py_ssize_t __pyx_t_158;
  Py_ssize_t __pyx_t_159;
  Py_ssize_t __pyx_t_160;
  Py_ssize_t __pyx_t_161;
  Py_ssize_t __pyx_t_162;
  Py_ssize_t __pyx_t_163;
  Py_ssize_t __pyx_t_164;
  Py_ssize_t __pyx_t_165;
  Py_ssize_t __pyx_t_166;
  Py_ssize_t __pyx_t_167;
  Py_ssize_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  Py_ssize_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  Py_ssize_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  Py_ssize_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  Py_ssize_t __pyx_t_176;
  PyObject *__pyx_t_177 = NULL;
  PyObject *__pyx_t_178 = NULL;
  PyObject *__pyx_t_179 = NULL;
  __Pyx_RefNannySetupContext("noise_correlation", 0);

  /* "pyross/inference.pyx":5157
 *     cdef noise_correlation(self, double [:] x, double [:, :] l, double [:] r, double tau0):
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, class_index             # <<<<<<<<<<<<<<
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.M;
  __pyx_v_M = __pyx_t_1;

  /* "pyross/inference.pyx":5158
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, class_index
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN             # <<<<<<<<<<<<<<
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             double [:, :, :, :] B=self.B
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.nClass;
  __pyx_v_nClass = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassU;
  __pyx_v_nClassU = __pyx_t_1;
  __pyx_t_1 = __pyx_v_self->nClassUwoN;
  __pyx_v_nClassUwoN = __pyx_t_1;

  /* "pyross/inference.pyx":5159
 *             Py_ssize_t i, m, n, M=self.M, class_index
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']             # <<<<<<<<<<<<<<
 *             double [:, :, :, :] B=self.B
 *             double [:, :] CM=self.CM
 */
  if (unlikely(__pyx_v_self->__pyx_base.class_index_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 5159, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base.class_index_dict, __pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 5159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_S_index = __pyx_t_1;

  /* "pyross/inference.pyx":5160
 *             Py_ssize_t nClass=self.nClass, nClassU=self.nClassU, nClassUwoN=self.nClassUwoN
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             double [:, :, :, :] B=self.B             # <<<<<<<<<<<<<<
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 */
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(((PyObject *)__pyx_v_self->__pyx_base.B), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 5160, __pyx_L1_error)
  __pyx_v_B = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pyross/inference.pyx":5161
 *             Py_ssize_t rate_index, infective_index, product_index, reagent_index, S_index=self.class_index_dict['S']
 *             double [:, :, :, :] B=self.B
 *             double [:, :] CM=self.CM             # <<<<<<<<<<<<<<
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] constant_terms=self.constant_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->__pyx_base.CM), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 5161, __pyx_L1_error)
  __pyx_v_CM = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":5162
 *             double [:, :, :, :] B=self.B
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters             # <<<<<<<<<<<<<<
 *             int [:, :] constant_terms=self.constant_terms
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 */
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(((PyObject *)__pyx_v_self->model_parameters), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 5162, __pyx_L1_error)
  __pyx_v_parameters = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pyross/inference.pyx":5163
 *             double [:, :] CM=self.CM
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] constant_terms=self.constant_terms             # <<<<<<<<<<<<<<
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:] test_pos=self.test_pos
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->constant_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 5163, __pyx_L1_error)
  __pyx_v_constant_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":5164
 *             double [:, :] parameters=self.model_parameters
 *             int [:, :] constant_terms=self.constant_terms
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms             # <<<<<<<<<<<<<<
 *             int [:] test_pos=self.test_pos
 *             int [:] test_freq=self.test_freq
 */
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->linear_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 5164, __pyx_L1_error)
  __pyx_v_linear_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(((PyObject *)__pyx_v_self->infection_terms), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 5164, __pyx_L1_error)
  __pyx_v_infection_terms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pyross/inference.pyx":5165
 *             int [:, :] constant_terms=self.constant_terms
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:] test_pos=self.test_pos             # <<<<<<<<<<<<<<
 *             int [:] test_freq=self.test_freq
 *             double [:] s, reagent, rate
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_v_self->test_pos), PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 5165, __pyx_L1_error)
  __pyx_v_test_pos = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":5166
 *             int [:, :] linear_terms=self.linear_terms, infection_terms=self.infection_terms
 *             int [:] test_pos=self.test_pos
 *             int [:] test_freq=self.test_freq             # <<<<<<<<<<<<<<
 *             double [:] s, reagent, rate
 *             double term
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_v_self->test_freq), PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 5166, __pyx_L1_error)
  __pyx_v_test_freq = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "pyross/inference.pyx":5169
 *             double [:] s, reagent, rate
 *             double term
 *             double Omega=self.Omega             # <<<<<<<<<<<<<<
 *         s = x[S_index*M:(S_index+1)*M]
 * 
 */
  __pyx_t_7 = __pyx_v_self->__pyx_base.Omega;
  __pyx_v_Omega = __pyx_t_7;

  /* "pyross/inference.pyx":5170
 *             double term
 *             double Omega=self.Omega
 *         s = x[S_index*M:(S_index+1)*M]             # <<<<<<<<<<<<<<
 * 
 *         if self.constant_terms.size > 0:
 */
  __pyx_t_8.data = __pyx_v_x.data;
  __pyx_t_8.memview = __pyx_v_x.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
  __pyx_t_9 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_8,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    (__pyx_v_S_index * __pyx_v_M),
    ((__pyx_v_S_index + 1) * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 5170, __pyx_L1_error)
}

__pyx_v_s = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;

  /* "pyross/inference.pyx":5172
 *         s = x[S_index*M:(S_index+1)*M]
 * 
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->constant_terms), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 5172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_11) {

    /* "pyross/inference.pyx":5173
 * 
 *         if self.constant_terms.size > 0:
 *             for i in range(constant_terms.shape[0]):             # <<<<<<<<<<<<<<
 *                 rate_index = constant_terms[i, 0]
 *                 class_index = constant_terms[i, 1]
 */
    __pyx_t_1 = (__pyx_v_constant_terms.shape[0]);
    __pyx_t_12 = __pyx_t_1;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pyross/inference.pyx":5174
 *         if self.constant_terms.size > 0:
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]             # <<<<<<<<<<<<<<
 *                 class_index = constant_terms[i, 1]
 *                 rate = parameters[rate_index]
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = 0;
      __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_constant_terms.data + __pyx_t_14 * __pyx_v_constant_terms.strides[0]) ) + __pyx_t_15 * __pyx_v_constant_terms.strides[1]) )));

      /* "pyross/inference.pyx":5175
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]
 *                 class_index = constant_terms[i, 1]             # <<<<<<<<<<<<<<
 *                 rate = parameters[rate_index]
 *                 for m in range(M):
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = 1;
      __pyx_v_class_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_constant_terms.data + __pyx_t_16 * __pyx_v_constant_terms.strides[0]) ) + __pyx_t_17 * __pyx_v_constant_terms.strides[1]) )));

      /* "pyross/inference.pyx":5176
 *                 rate_index = constant_terms[i, 0]
 *                 class_index = constant_terms[i, 1]
 *                 rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *                 for m in range(M):
 *                     B[class_index, m, class_index, m] += rate[m]/Omega
 */
      __pyx_t_8.data = __pyx_v_parameters.data;
      __pyx_t_8.memview = __pyx_v_parameters.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
      {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 5176, __pyx_L1_error)
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_8.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
      __pyx_v_rate = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

      /* "pyross/inference.pyx":5177
 *                 class_index = constant_terms[i, 1]
 *                 rate = parameters[rate_index]
 *                 for m in range(M):             # <<<<<<<<<<<<<<
 *                     B[class_index, m, class_index, m] += rate[m]/Omega
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega
 */
      __pyx_t_18 = __pyx_v_M;
      __pyx_t_19 = __pyx_t_18;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_m = __pyx_t_20;

        /* "pyross/inference.pyx":5178
 *                 rate = parameters[rate_index]
 *                 for m in range(M):
 *                     B[class_index, m, class_index, m] += rate[m]/Omega             # <<<<<<<<<<<<<<
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega
 * 
 */
        __pyx_t_21 = __pyx_v_m;
        __pyx_t_22 = __pyx_v_class_index;
        __pyx_t_23 = __pyx_v_m;
        __pyx_t_24 = __pyx_v_class_index;
        __pyx_t_25 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_22 * __pyx_v_B.strides[0]) ) + __pyx_t_23 * __pyx_v_B.strides[1]) ) + __pyx_t_24 * __pyx_v_B.strides[2]) ) + __pyx_t_25 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_21 * __pyx_v_rate.strides[0]) ))) / __pyx_v_Omega);

        /* "pyross/inference.pyx":5179
 *                 for m in range(M):
 *                     B[class_index, m, class_index, m] += rate[m]/Omega
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega             # <<<<<<<<<<<<<<
 * 
 *         for i in range(infection_terms.shape[0]):
 */
        __pyx_t_26 = __pyx_v_m;
        __pyx_t_27 = (__pyx_v_nClass - 1);
        __pyx_t_28 = __pyx_v_m;
        __pyx_t_29 = (__pyx_v_nClass - 1);
        __pyx_t_30 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_27 * __pyx_v_B.strides[0]) ) + __pyx_t_28 * __pyx_v_B.strides[1]) ) + __pyx_t_29 * __pyx_v_B.strides[2]) ) + __pyx_t_30 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_26 * __pyx_v_rate.strides[0]) ))) / __pyx_v_Omega);
      }
    }

    /* "pyross/inference.pyx":5172
 *         s = x[S_index*M:(S_index+1)*M]
 * 
 *         if self.constant_terms.size > 0:             # <<<<<<<<<<<<<<
 *             for i in range(constant_terms.shape[0]):
 *                 rate_index = constant_terms[i, 0]
 */
  }

  /* "pyross/inference.pyx":5181
 *                     B[nClass-1, m, nClass-1, m] += rate[m]/Omega
 * 
 *         for i in range(infection_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_infection_terms.shape[0]);
  __pyx_t_12 = __pyx_t_1;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pyross/inference.pyx":5182
 * 
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]             # <<<<<<<<<<<<<<
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 */
    __pyx_t_31 = __pyx_v_i;
    __pyx_t_32 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_31 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_32 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5183
 *         for i in range(infection_terms.shape[0]):
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]             # <<<<<<<<<<<<<<
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_33 = __pyx_v_i;
    __pyx_t_34 = 1;
    __pyx_v_infective_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_33 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_34 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5184
 *             product_index = infection_terms[i, 2]
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M):
 */
    __pyx_t_35 = __pyx_v_i;
    __pyx_t_36 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_infection_terms.data + __pyx_t_35 * __pyx_v_infection_terms.strides[0]) ) + __pyx_t_36 * __pyx_v_infection_terms.strides[1]) )));

    /* "pyross/inference.pyx":5185
 *             infective_index = infection_terms[i, 1]
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 */
    __pyx_t_8.data = __pyx_v_parameters.data;
    __pyx_t_8.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 5185, __pyx_L1_error)
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_8.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;

    /* "pyross/inference.pyx":5186
 *             rate_index = infection_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M):             # <<<<<<<<<<<<<<
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:
 */
    __pyx_t_18 = __pyx_v_M;
    __pyx_t_19 = __pyx_t_18;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_m = __pyx_t_20;

      /* "pyross/inference.pyx":5187
 *             rate = parameters[rate_index]
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 */
      __pyx_t_37 = __pyx_v_m;
      __pyx_t_38 = __pyx_v_i;
      __pyx_t_39 = __pyx_v_m;
      __pyx_t_40 = __pyx_v_m;
      __pyx_t_41 = __pyx_v_S_index;
      __pyx_t_42 = __pyx_v_m;
      __pyx_t_43 = __pyx_v_S_index;
      __pyx_t_44 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_41 * __pyx_v_B.strides[0]) ) + __pyx_t_42 * __pyx_v_B.strides[1]) ) + __pyx_t_43 * __pyx_v_B.strides[2]) ) + __pyx_t_44 * __pyx_v_B.strides[3]) )) += (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_37 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_38 * __pyx_v_l.strides[0]) ) + __pyx_t_39 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_40 * __pyx_v_s.strides[0]) ))));

      /* "pyross/inference.pyx":5188
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 */
      __pyx_t_11 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_11) {

        /* "pyross/inference.pyx":5189
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]
 */
        __pyx_t_45 = __pyx_v_m;
        __pyx_t_46 = __pyx_v_i;
        __pyx_t_47 = __pyx_v_m;
        __pyx_t_48 = __pyx_v_m;
        __pyx_t_49 = __pyx_v_S_index;
        __pyx_t_50 = __pyx_v_m;
        __pyx_t_51 = __pyx_v_product_index;
        __pyx_t_52 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_49 * __pyx_v_B.strides[0]) ) + __pyx_t_50 * __pyx_v_B.strides[1]) ) + __pyx_t_51 * __pyx_v_B.strides[2]) ) + __pyx_t_52 * __pyx_v_B.strides[3]) )) -= (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_45 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_46 * __pyx_v_l.strides[0]) ) + __pyx_t_47 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_48 * __pyx_v_s.strides[0]) ))));

        /* "pyross/inference.pyx":5190
 *                 if product_index>-1:
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]
 * 
 */
        __pyx_t_53 = __pyx_v_m;
        __pyx_t_54 = __pyx_v_i;
        __pyx_t_55 = __pyx_v_m;
        __pyx_t_56 = __pyx_v_m;
        __pyx_t_57 = __pyx_v_product_index;
        __pyx_t_58 = __pyx_v_m;
        __pyx_t_59 = __pyx_v_product_index;
        __pyx_t_60 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_57 * __pyx_v_B.strides[0]) ) + __pyx_t_58 * __pyx_v_B.strides[1]) ) + __pyx_t_59 * __pyx_v_B.strides[2]) ) + __pyx_t_60 * __pyx_v_B.strides[3]) )) += (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_53 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_54 * __pyx_v_l.strides[0]) ) + __pyx_t_55 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_56 * __pyx_v_s.strides[0]) ))));

        /* "pyross/inference.pyx":5191
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(linear_terms.shape[0]):
 */
        __pyx_t_61 = __pyx_v_m;
        __pyx_t_62 = __pyx_v_i;
        __pyx_t_63 = __pyx_v_m;
        __pyx_t_64 = __pyx_v_m;
        __pyx_t_65 = __pyx_v_product_index;
        __pyx_t_66 = __pyx_v_m;
        __pyx_t_67 = __pyx_v_S_index;
        __pyx_t_68 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_65 * __pyx_v_B.strides[0]) ) + __pyx_t_66 * __pyx_v_B.strides[1]) ) + __pyx_t_67 * __pyx_v_B.strides[2]) ) + __pyx_t_68 * __pyx_v_B.strides[3]) )) -= (((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_61 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_l.data + __pyx_t_62 * __pyx_v_l.strides[0]) ) + __pyx_t_63 * __pyx_v_l.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_s.data + __pyx_t_64 * __pyx_v_s.strides[0]) ))));

        /* "pyross/inference.pyx":5188
 *             for m in range(M):
 *                 B[S_index, m, S_index, m] += rate[m]*l[i, m]*s[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[S_index, m, product_index, m] -=  rate[m]*l[i, m]*s[m]
 *                     B[product_index, m, product_index, m] += rate[m]*l[i, m]*s[m]
 */
      }
    }
  }

  /* "pyross/inference.pyx":5193
 *                     B[product_index, m, S_index, m] -= rate[m]*l[i, m]*s[m]
 * 
 *         for i in range(linear_terms.shape[0]):             # <<<<<<<<<<<<<<
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 */
  __pyx_t_1 = (__pyx_v_linear_terms.shape[0]);
  __pyx_t_12 = __pyx_t_1;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pyross/inference.pyx":5194
 * 
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]             # <<<<<<<<<<<<<<
 *             reagent_index = linear_terms[i, 1]
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 */
    __pyx_t_69 = __pyx_v_i;
    __pyx_t_70 = 2;
    __pyx_v_product_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_69 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_70 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":5195
 *         for i in range(linear_terms.shape[0]):
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]             # <<<<<<<<<<<<<<
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 *             rate_index = linear_terms[i, 0]
 */
    __pyx_t_71 = __pyx_v_i;
    __pyx_t_72 = 1;
    __pyx_v_reagent_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_71 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_72 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":5196
 *             product_index = linear_terms[i, 2]
 *             reagent_index = linear_terms[i, 1]
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]             # <<<<<<<<<<<<<<
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 */
    __pyx_t_8.data = __pyx_v_x.data;
    __pyx_t_8.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    __pyx_t_9 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_8,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    (__pyx_v_reagent_index * __pyx_v_M),
    ((__pyx_v_reagent_index + 1) * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 5196, __pyx_L1_error)
}

__PYX_XDEC_MEMVIEW(&__pyx_v_reagent, 1);
    __pyx_v_reagent = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;

    /* "pyross/inference.pyx":5197
 *             reagent_index = linear_terms[i, 1]
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 *             rate_index = linear_terms[i, 0]             # <<<<<<<<<<<<<<
 *             rate = parameters[rate_index]
 *             for m in range(M): # only fill in the upper triangular form
 */
    __pyx_t_73 = __pyx_v_i;
    __pyx_t_74 = 0;
    __pyx_v_rate_index = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_linear_terms.data + __pyx_t_73 * __pyx_v_linear_terms.strides[0]) ) + __pyx_t_74 * __pyx_v_linear_terms.strides[1]) )));

    /* "pyross/inference.pyx":5198
 *             reagent = x[reagent_index*M:(reagent_index+1)*M]
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]             # <<<<<<<<<<<<<<
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 */
    __pyx_t_8.data = __pyx_v_parameters.data;
    __pyx_t_8.memview = __pyx_v_parameters.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = __pyx_v_rate_index;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_parameters.strides[0];
        if ((0)) __PYX_ERR(0, 5198, __pyx_L1_error)
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_parameters.shape[1];
__pyx_t_8.strides[0] = __pyx_v_parameters.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
    __pyx_v_rate = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;

    /* "pyross/inference.pyx":5199
 *             rate_index = linear_terms[i, 0]
 *             rate = parameters[rate_index]
 *             for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:
 */
    __pyx_t_18 = __pyx_v_M;
    __pyx_t_19 = __pyx_t_18;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_m = __pyx_t_20;

      /* "pyross/inference.pyx":5200
 *             rate = parameters[rate_index]
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 */
      __pyx_t_75 = __pyx_v_m;
      __pyx_t_76 = __pyx_v_m;
      __pyx_t_77 = __pyx_v_reagent_index;
      __pyx_t_78 = __pyx_v_m;
      __pyx_t_79 = __pyx_v_reagent_index;
      __pyx_t_80 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_77 * __pyx_v_B.strides[0]) ) + __pyx_t_78 * __pyx_v_B.strides[1]) ) + __pyx_t_79 * __pyx_v_B.strides[2]) ) + __pyx_t_80 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_75 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_76 * __pyx_v_reagent.strides[0]) ))));

      /* "pyross/inference.pyx":5201
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 */
      __pyx_t_11 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_11) {

        /* "pyross/inference.pyx":5202
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 */
        __pyx_t_81 = __pyx_v_m;
        __pyx_t_82 = __pyx_v_m;
        __pyx_t_83 = __pyx_v_product_index;
        __pyx_t_84 = __pyx_v_m;
        __pyx_t_85 = __pyx_v_product_index;
        __pyx_t_86 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_83 * __pyx_v_B.strides[0]) ) + __pyx_t_84 * __pyx_v_B.strides[1]) ) + __pyx_t_85 * __pyx_v_B.strides[2]) ) + __pyx_t_86 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_81 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_82 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":5203
 *                 if product_index>-1:
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 *             # same transitions in Q classes
 */
        __pyx_t_87 = __pyx_v_m;
        __pyx_t_88 = __pyx_v_m;
        __pyx_t_89 = __pyx_v_reagent_index;
        __pyx_t_90 = __pyx_v_m;
        __pyx_t_91 = __pyx_v_product_index;
        __pyx_t_92 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_89 * __pyx_v_B.strides[0]) ) + __pyx_t_90 * __pyx_v_B.strides[1]) ) + __pyx_t_91 * __pyx_v_B.strides[2]) ) + __pyx_t_92 * __pyx_v_B.strides[3]) )) += ((-(*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_87 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_88 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":5204
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *             # same transitions in Q classes
 *             reagent = x[(reagent_index+nClassU)*M:((reagent_index+nClassU)+1)*M]
 */
        __pyx_t_93 = __pyx_v_m;
        __pyx_t_94 = __pyx_v_m;
        __pyx_t_95 = __pyx_v_product_index;
        __pyx_t_96 = __pyx_v_m;
        __pyx_t_97 = __pyx_v_reagent_index;
        __pyx_t_98 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_95 * __pyx_v_B.strides[0]) ) + __pyx_t_96 * __pyx_v_B.strides[1]) ) + __pyx_t_97 * __pyx_v_B.strides[2]) ) + __pyx_t_98 * __pyx_v_B.strides[3]) )) += ((-(*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_93 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_94 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":5201
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index, m, reagent_index, m] += rate[m]*reagent[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[product_index, m, product_index, m] += rate[m]*reagent[m]
 *                     B[reagent_index, m, product_index, m] += -rate[m]*reagent[m]
 */
      }
    }

    /* "pyross/inference.pyx":5206
 *                     B[product_index, m, reagent_index, m] += -rate[m]*reagent[m]
 *             # same transitions in Q classes
 *             reagent = x[(reagent_index+nClassU)*M:((reagent_index+nClassU)+1)*M]             # <<<<<<<<<<<<<<
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index+nClassU, m, reagent_index+nClassU, m] += rate[m]*reagent[m]
 */
    __pyx_t_8.data = __pyx_v_x.data;
    __pyx_t_8.memview = __pyx_v_x.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    __pyx_t_9 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_8,
    __pyx_v_x.shape[0], __pyx_v_x.strides[0], __pyx_v_x.suboffsets[0],
    0,
    0,
    &__pyx_t_9,
    ((__pyx_v_reagent_index + __pyx_v_nClassU) * __pyx_v_M),
    (((__pyx_v_reagent_index + __pyx_v_nClassU) + 1) * __pyx_v_M),
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 5206, __pyx_L1_error)
}

__PYX_XDEC_MEMVIEW(&__pyx_v_reagent, 1);
    __pyx_v_reagent = __pyx_t_8;
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;

    /* "pyross/inference.pyx":5207
 *             # same transitions in Q classes
 *             reagent = x[(reagent_index+nClassU)*M:((reagent_index+nClassU)+1)*M]
 *             for m in range(M): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *                 B[reagent_index+nClassU, m, reagent_index+nClassU, m] += rate[m]*reagent[m]
 *                 if product_index>-1:
 */
    __pyx_t_18 = __pyx_v_M;
    __pyx_t_19 = __pyx_t_18;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_m = __pyx_t_20;

      /* "pyross/inference.pyx":5208
 *             reagent = x[(reagent_index+nClassU)*M:((reagent_index+nClassU)+1)*M]
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index+nClassU, m, reagent_index+nClassU, m] += rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                 if product_index>-1:
 *                     B[product_index+nClassU, m, product_index+nClassU, m] += rate[m]*reagent[m]
 */
      __pyx_t_99 = __pyx_v_m;
      __pyx_t_100 = __pyx_v_m;
      __pyx_t_101 = (__pyx_v_reagent_index + __pyx_v_nClassU);
      __pyx_t_102 = __pyx_v_m;
      __pyx_t_103 = (__pyx_v_reagent_index + __pyx_v_nClassU);
      __pyx_t_104 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_101 * __pyx_v_B.strides[0]) ) + __pyx_t_102 * __pyx_v_B.strides[1]) ) + __pyx_t_103 * __pyx_v_B.strides[2]) ) + __pyx_t_104 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_99 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_100 * __pyx_v_reagent.strides[0]) ))));

      /* "pyross/inference.pyx":5209
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index+nClassU, m, reagent_index+nClassU, m] += rate[m]*reagent[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[product_index+nClassU, m, product_index+nClassU, m] += rate[m]*reagent[m]
 *                     B[reagent_index+nClassU, m, product_index+nClassU, m] += -rate[m]*reagent[m]
 */
      __pyx_t_11 = ((__pyx_v_product_index > -1L) != 0);
      if (__pyx_t_11) {

        /* "pyross/inference.pyx":5210
 *                 B[reagent_index+nClassU, m, reagent_index+nClassU, m] += rate[m]*reagent[m]
 *                 if product_index>-1:
 *                     B[product_index+nClassU, m, product_index+nClassU, m] += rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                     B[reagent_index+nClassU, m, product_index+nClassU, m] += -rate[m]*reagent[m]
 *                     B[product_index+nClassU, m, reagent_index+nClassU, m] += -rate[m]*reagent[m]
 */
        __pyx_t_105 = __pyx_v_m;
        __pyx_t_106 = __pyx_v_m;
        __pyx_t_107 = (__pyx_v_product_index + __pyx_v_nClassU);
        __pyx_t_108 = __pyx_v_m;
        __pyx_t_109 = (__pyx_v_product_index + __pyx_v_nClassU);
        __pyx_t_110 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_107 * __pyx_v_B.strides[0]) ) + __pyx_t_108 * __pyx_v_B.strides[1]) ) + __pyx_t_109 * __pyx_v_B.strides[2]) ) + __pyx_t_110 * __pyx_v_B.strides[3]) )) += ((*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_105 * __pyx_v_rate.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_106 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":5211
 *                 if product_index>-1:
 *                     B[product_index+nClassU, m, product_index+nClassU, m] += rate[m]*reagent[m]
 *                     B[reagent_index+nClassU, m, product_index+nClassU, m] += -rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 *                     B[product_index+nClassU, m, reagent_index+nClassU, m] += -rate[m]*reagent[m]
 * 
 */
        __pyx_t_111 = __pyx_v_m;
        __pyx_t_112 = __pyx_v_m;
        __pyx_t_113 = (__pyx_v_reagent_index + __pyx_v_nClassU);
        __pyx_t_114 = __pyx_v_m;
        __pyx_t_115 = (__pyx_v_product_index + __pyx_v_nClassU);
        __pyx_t_116 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_113 * __pyx_v_B.strides[0]) ) + __pyx_t_114 * __pyx_v_B.strides[1]) ) + __pyx_t_115 * __pyx_v_B.strides[2]) ) + __pyx_t_116 * __pyx_v_B.strides[3]) )) += ((-(*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_111 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_112 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":5212
 *                     B[product_index+nClassU, m, product_index+nClassU, m] += rate[m]*reagent[m]
 *                     B[reagent_index+nClassU, m, product_index+nClassU, m] += -rate[m]*reagent[m]
 *                     B[product_index+nClassU, m, reagent_index+nClassU, m] += -rate[m]*reagent[m]             # <<<<<<<<<<<<<<
 * 
 *         for m in range(M):
 */
        __pyx_t_117 = __pyx_v_m;
        __pyx_t_118 = __pyx_v_m;
        __pyx_t_119 = (__pyx_v_product_index + __pyx_v_nClassU);
        __pyx_t_120 = __pyx_v_m;
        __pyx_t_121 = (__pyx_v_reagent_index + __pyx_v_nClassU);
        __pyx_t_122 = __pyx_v_m;
        *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_119 * __pyx_v_B.strides[0]) ) + __pyx_t_120 * __pyx_v_B.strides[1]) ) + __pyx_t_121 * __pyx_v_B.strides[2]) ) + __pyx_t_122 * __pyx_v_B.strides[3]) )) += ((-(*((double *) ( /* dim=0 */ (__pyx_v_rate.data + __pyx_t_117 * __pyx_v_rate.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_reagent.data + __pyx_t_118 * __pyx_v_reagent.strides[0]) ))));

        /* "pyross/inference.pyx":5209
 *             for m in range(M): # only fill in the upper triangular form
 *                 B[reagent_index+nClassU, m, reagent_index+nClassU, m] += rate[m]*reagent[m]
 *                 if product_index>-1:             # <<<<<<<<<<<<<<
 *                     B[product_index+nClassU, m, product_index+nClassU, m] += rate[m]*reagent[m]
 *                     B[reagent_index+nClassU, m, product_index+nClassU, m] += -rate[m]*reagent[m]
 */
      }
    }
  }

  /* "pyross/inference.pyx":5214
 *                     B[product_index+nClassU, m, reagent_index+nClassU, m] += -rate[m]*reagent[m]
 * 
 *         for m in range(M):             # <<<<<<<<<<<<<<
 *             for i in range(nClassUwoN): # only fill in the upper triangular form
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m] * x[m+M*i]
 */
  __pyx_t_1 = __pyx_v_M;
  __pyx_t_12 = __pyx_t_1;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_m = __pyx_t_13;

    /* "pyross/inference.pyx":5215
 * 
 *         for m in range(M):
 *             for i in range(nClassUwoN): # only fill in the upper triangular form             # <<<<<<<<<<<<<<
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m] * x[m+M*i]
 *                 B[i, m, i, m] += term
 */
    __pyx_t_18 = __pyx_v_nClassUwoN;
    __pyx_t_19 = __pyx_t_18;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_i = __pyx_t_20;

      /* "pyross/inference.pyx":5216
 *         for m in range(M):
 *             for i in range(nClassUwoN): # only fill in the upper triangular form
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m] * x[m+M*i]             # <<<<<<<<<<<<<<
 *                 B[i, m, i, m] += term
 *                 B[i+nClassU, m, i+nClassU, m] += term
 */
      __pyx_t_123 = __pyx_v_i;
      __pyx_t_124 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_123 * __pyx_v_test_freq.strides[0]) )));
      __pyx_t_125 = __pyx_v_m;
      __pyx_t_126 = __pyx_v_i;
      __pyx_t_127 = (*((int *) ( /* dim=0 */ (__pyx_v_test_pos.data + __pyx_t_126 * __pyx_v_test_pos.strides[0]) )));
      __pyx_t_128 = __pyx_v_m;
      __pyx_t_129 = (__pyx_v_m + (__pyx_v_M * __pyx_v_i));
      __pyx_v_term = (((__pyx_v_tau0 * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_124 * __pyx_v_parameters.strides[0]) ) + __pyx_t_125 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_127 * __pyx_v_parameters.strides[0]) ) + __pyx_t_128 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_129 * __pyx_v_x.strides[0]) ))));

      /* "pyross/inference.pyx":5217
 *             for i in range(nClassUwoN): # only fill in the upper triangular form
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m] * x[m+M*i]
 *                 B[i, m, i, m] += term             # <<<<<<<<<<<<<<
 *                 B[i+nClassU, m, i+nClassU, m] += term
 *                 B[nClass-1, m, nClass-1, m] += term
 */
      __pyx_t_130 = __pyx_v_i;
      __pyx_t_131 = __pyx_v_m;
      __pyx_t_132 = __pyx_v_i;
      __pyx_t_133 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_130 * __pyx_v_B.strides[0]) ) + __pyx_t_131 * __pyx_v_B.strides[1]) ) + __pyx_t_132 * __pyx_v_B.strides[2]) ) + __pyx_t_133 * __pyx_v_B.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5218
 *                 term = tau0 * parameters[test_freq[i], m] * parameters[test_pos[i], m] * x[m+M*i]
 *                 B[i, m, i, m] += term
 *                 B[i+nClassU, m, i+nClassU, m] += term             # <<<<<<<<<<<<<<
 *                 B[nClass-1, m, nClass-1, m] += term
 *                 B[i, m, i+nClassU, m] -= term
 */
      __pyx_t_134 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_135 = __pyx_v_m;
      __pyx_t_136 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_137 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_134 * __pyx_v_B.strides[0]) ) + __pyx_t_135 * __pyx_v_B.strides[1]) ) + __pyx_t_136 * __pyx_v_B.strides[2]) ) + __pyx_t_137 * __pyx_v_B.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5219
 *                 B[i, m, i, m] += term
 *                 B[i+nClassU, m, i+nClassU, m] += term
 *                 B[nClass-1, m, nClass-1, m] += term             # <<<<<<<<<<<<<<
 *                 B[i, m, i+nClassU, m] -= term
 *                 B[i+nClassU, m, i, m] -= term
 */
      __pyx_t_138 = (__pyx_v_nClass - 1);
      __pyx_t_139 = __pyx_v_m;
      __pyx_t_140 = (__pyx_v_nClass - 1);
      __pyx_t_141 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_138 * __pyx_v_B.strides[0]) ) + __pyx_t_139 * __pyx_v_B.strides[1]) ) + __pyx_t_140 * __pyx_v_B.strides[2]) ) + __pyx_t_141 * __pyx_v_B.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5220
 *                 B[i+nClassU, m, i+nClassU, m] += term
 *                 B[nClass-1, m, nClass-1, m] += term
 *                 B[i, m, i+nClassU, m] -= term             # <<<<<<<<<<<<<<
 *                 B[i+nClassU, m, i, m] -= term
 *                 B[i, m, nClass-1, m] -= term
 */
      __pyx_t_142 = __pyx_v_i;
      __pyx_t_143 = __pyx_v_m;
      __pyx_t_144 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_145 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_142 * __pyx_v_B.strides[0]) ) + __pyx_t_143 * __pyx_v_B.strides[1]) ) + __pyx_t_144 * __pyx_v_B.strides[2]) ) + __pyx_t_145 * __pyx_v_B.strides[3]) )) -= __pyx_v_term;

      /* "pyross/inference.pyx":5221
 *                 B[nClass-1, m, nClass-1, m] += term
 *                 B[i, m, i+nClassU, m] -= term
 *                 B[i+nClassU, m, i, m] -= term             # <<<<<<<<<<<<<<
 *                 B[i, m, nClass-1, m] -= term
 *                 B[nClass-1, m, i, m] -= term
 */
      __pyx_t_146 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_147 = __pyx_v_m;
      __pyx_t_148 = __pyx_v_i;
      __pyx_t_149 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_146 * __pyx_v_B.strides[0]) ) + __pyx_t_147 * __pyx_v_B.strides[1]) ) + __pyx_t_148 * __pyx_v_B.strides[2]) ) + __pyx_t_149 * __pyx_v_B.strides[3]) )) -= __pyx_v_term;

      /* "pyross/inference.pyx":5222
 *                 B[i, m, i+nClassU, m] -= term
 *                 B[i+nClassU, m, i, m] -= term
 *                 B[i, m, nClass-1, m] -= term             # <<<<<<<<<<<<<<
 *                 B[nClass-1, m, i, m] -= term
 *                 B[i+nClassU, m, nClass-1, m] += term
 */
      __pyx_t_150 = __pyx_v_i;
      __pyx_t_151 = __pyx_v_m;
      __pyx_t_152 = (__pyx_v_nClass - 1);
      __pyx_t_153 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_150 * __pyx_v_B.strides[0]) ) + __pyx_t_151 * __pyx_v_B.strides[1]) ) + __pyx_t_152 * __pyx_v_B.strides[2]) ) + __pyx_t_153 * __pyx_v_B.strides[3]) )) -= __pyx_v_term;

      /* "pyross/inference.pyx":5223
 *                 B[i+nClassU, m, i, m] -= term
 *                 B[i, m, nClass-1, m] -= term
 *                 B[nClass-1, m, i, m] -= term             # <<<<<<<<<<<<<<
 *                 B[i+nClassU, m, nClass-1, m] += term
 *                 B[nClass-1, m, i+nClassU, m] += term
 */
      __pyx_t_154 = (__pyx_v_nClass - 1);
      __pyx_t_155 = __pyx_v_m;
      __pyx_t_156 = __pyx_v_i;
      __pyx_t_157 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_154 * __pyx_v_B.strides[0]) ) + __pyx_t_155 * __pyx_v_B.strides[1]) ) + __pyx_t_156 * __pyx_v_B.strides[2]) ) + __pyx_t_157 * __pyx_v_B.strides[3]) )) -= __pyx_v_term;

      /* "pyross/inference.pyx":5224
 *                 B[i, m, nClass-1, m] -= term
 *                 B[nClass-1, m, i, m] -= term
 *                 B[i+nClassU, m, nClass-1, m] += term             # <<<<<<<<<<<<<<
 *                 B[nClass-1, m, i+nClassU, m] += term
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m] * r[m]
 */
      __pyx_t_158 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_159 = __pyx_v_m;
      __pyx_t_160 = (__pyx_v_nClass - 1);
      __pyx_t_161 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_158 * __pyx_v_B.strides[0]) ) + __pyx_t_159 * __pyx_v_B.strides[1]) ) + __pyx_t_160 * __pyx_v_B.strides[2]) ) + __pyx_t_161 * __pyx_v_B.strides[3]) )) += __pyx_v_term;

      /* "pyross/inference.pyx":5225
 *                 B[nClass-1, m, i, m] -= term
 *                 B[i+nClassU, m, nClass-1, m] += term
 *                 B[nClass-1, m, i+nClassU, m] += term             # <<<<<<<<<<<<<<
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m] * r[m]
 *             B[nClass-1, m, nClass-1, m] += term
 */
      __pyx_t_162 = (__pyx_v_nClass - 1);
      __pyx_t_163 = __pyx_v_m;
      __pyx_t_164 = (__pyx_v_i + __pyx_v_nClassU);
      __pyx_t_165 = __pyx_v_m;
      *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_162 * __pyx_v_B.strides[0]) ) + __pyx_t_163 * __pyx_v_B.strides[1]) ) + __pyx_t_164 * __pyx_v_B.strides[2]) ) + __pyx_t_165 * __pyx_v_B.strides[3]) )) += __pyx_v_term;
    }

    /* "pyross/inference.pyx":5226
 *                 B[i+nClassU, m, nClass-1, m] += term
 *                 B[nClass-1, m, i+nClassU, m] += term
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m] * r[m]             # <<<<<<<<<<<<<<
 *             B[nClass-1, m, nClass-1, m] += term
 * 
 */
    __pyx_t_166 = __pyx_v_nClassUwoN;
    __pyx_t_167 = (*((int *) ( /* dim=0 */ (__pyx_v_test_freq.data + __pyx_t_166 * __pyx_v_test_freq.strides[0]) )));
    __pyx_t_168 = __pyx_v_m;
    __pyx_t_169 = __pyx_v_nClassUwoN;
    __pyx_t_170 = (*((int *) ( /* dim=0 */ (__pyx_v_test_pos.data + __pyx_t_169 * __pyx_v_test_pos.strides[0]) )));
    __pyx_t_171 = __pyx_v_m;
    __pyx_t_172 = __pyx_v_m;
    __pyx_v_term = (((__pyx_v_tau0 * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_167 * __pyx_v_parameters.strides[0]) ) + __pyx_t_168 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_parameters.data + __pyx_t_170 * __pyx_v_parameters.strides[0]) ) + __pyx_t_171 * __pyx_v_parameters.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_r.data + __pyx_t_172 * __pyx_v_r.strides[0]) ))));

    /* "pyross/inference.pyx":5227
 *                 B[nClass-1, m, i+nClassU, m] += term
 *             term = tau0 * parameters[test_freq[nClassUwoN], m] * parameters[test_pos[nClassUwoN], m] * r[m]
 *             B[nClass-1, m, nClass-1, m] += term             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_173 = (__pyx_v_nClass - 1);
    __pyx_t_174 = __pyx_v_m;
    __pyx_t_175 = (__pyx_v_nClass - 1);
    __pyx_t_176 = __pyx_v_m;
    *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B.data + __pyx_t_173 * __pyx_v_B.strides[0]) ) + __pyx_t_174 * __pyx_v_B.strides[1]) ) + __pyx_t_175 * __pyx_v_B.strides[2]) ) + __pyx_t_176 * __pyx_v_B.strides[3]) )) += __pyx_v_term;
  }

  /* "pyross/inference.pyx":5230
 * 
 * 
 *         self.B_vec = self.B.reshape((self.dim, self.dim))[(self.rows, self.cols)]             # <<<<<<<<<<<<<<
 * 
 * cdef class SppSparse(Spp):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.B), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_177 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_177)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_177);
  __pyx_t_178 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_178)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_178);
  __pyx_t_179 = PyTuple_New(2); if (unlikely(!__pyx_t_179)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_179);
  __Pyx_GIVEREF(__pyx_t_177);
  PyTuple_SET_ITEM(__pyx_t_179, 0, __pyx_t_177);
  __Pyx_GIVEREF(__pyx_t_178);
  PyTuple_SET_ITEM(__pyx_t_179, 1, __pyx_t_178);
  __pyx_t_177 = 0;
  __pyx_t_178 = 0;
  __pyx_t_178 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_178 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_178)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_178);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_10 = (__pyx_t_178) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_178, __pyx_t_179) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_179);
  __Pyx_XDECREF(__pyx_t_178); __pyx_t_178 = 0;
  __Pyx_DECREF(__pyx_t_179); __pyx_t_179 = 0;
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __pyx_t_179 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_179)) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_179);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_179) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_179, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5230, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_179);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __pyx_v_self->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_179);
  __pyx_t_179 = 0;

  /* "pyross/inference.pyx":5155
 *         self.J_mat = self.J.reshape((dim, dim))
 * 
 *     cdef noise_correlation(self, double [:] x, double [:, :] l, double [:] r, double tau0):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i, m, n, M=self.M, class_index
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_177);
  __Pyx_XDECREF(__pyx_t_178);
  __Pyx_XDECREF(__pyx_t_179);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.noise_correlation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_B, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_CM, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_parameters, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_constant_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_linear_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_infection_terms, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_test_pos, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_test_freq, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_s, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_reagent, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_rate, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4853
 *     """
 *     cdef:
 *         readonly np.ndarray constant_terms, linear_terms, infection_terms, test_pos, test_freq             # <<<<<<<<<<<<<<
 *         readonly Py_ssize_t nClassU, nClassUwoN
 *         readonly np.ndarray model_parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_14constant_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_14constant_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_14constant_terms___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_14constant_terms___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->constant_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->constant_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_12linear_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_12linear_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_12linear_terms___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_12linear_terms___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->linear_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->linear_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_15infection_terms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_15infection_terms_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_15infection_terms___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_15infection_terms___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->infection_terms));
  __pyx_r = ((PyObject *)__pyx_v_self->infection_terms);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_8test_pos_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_8test_pos_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_8test_pos___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_8test_pos___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->test_pos));
  __pyx_r = ((PyObject *)__pyx_v_self->test_pos);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_9test_freq_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_9test_freq_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_9test_freq___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_9test_freq___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->test_freq));
  __pyx_r = ((PyObject *)__pyx_v_self->test_freq);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4854
 *     cdef:
 *         readonly np.ndarray constant_terms, linear_terms, infection_terms, test_pos, test_freq
 *         readonly Py_ssize_t nClassU, nClassUwoN             # <<<<<<<<<<<<<<
 *         readonly np.ndarray model_parameters
 *         readonly pyross.deterministic.SppQ_old det_model
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_7nClassU_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_7nClassU_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_7nClassU___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_7nClassU___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->nClassU); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.nClassU.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_10nClassUwoN_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_10nClassUwoN_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_10nClassUwoN___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10nClassUwoN___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->nClassUwoN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.nClassUwoN.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4855
 *         readonly np.ndarray constant_terms, linear_terms, infection_terms, test_pos, test_freq
 *         readonly Py_ssize_t nClassU, nClassUwoN
 *         readonly np.ndarray model_parameters             # <<<<<<<<<<<<<<
 *         readonly pyross.deterministic.SppQ_old det_model
 *         readonly dict model_spec
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_16model_parameters_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_16model_parameters_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_16model_parameters___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_16model_parameters___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->model_parameters));
  __pyx_r = ((PyObject *)__pyx_v_self->model_parameters);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4856
 *         readonly Py_ssize_t nClassU, nClassUwoN
 *         readonly np.ndarray model_parameters
 *         readonly pyross.deterministic.SppQ_old det_model             # <<<<<<<<<<<<<<
 *         readonly dict model_spec
 *         readonly dict param_dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_9det_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_9det_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_9det_model___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_9det_model___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __pyx_r = ((PyObject *)__pyx_v_self->det_model);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4857
 *         readonly np.ndarray model_parameters
 *         readonly pyross.deterministic.SppQ_old det_model
 *         readonly dict model_spec             # <<<<<<<<<<<<<<
 *         readonly dict param_dict
 *         readonly list model_param_keys
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_10model_spec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_10model_spec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_10model_spec___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10model_spec___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->model_spec);
  __pyx_r = __pyx_v_self->model_spec;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4858
 *         readonly pyross.deterministic.SppQ_old det_model
 *         readonly dict model_spec
 *         readonly dict param_dict             # <<<<<<<<<<<<<<
 *         readonly list model_param_keys
 *         readonly object parameter_mapping
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_10param_dict_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_10param_dict_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_10param_dict___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_10param_dict___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->param_dict);
  __pyx_r = __pyx_v_self->param_dict;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4859
 *         readonly dict model_spec
 *         readonly dict param_dict
 *         readonly list model_param_keys             # <<<<<<<<<<<<<<
 *         readonly object parameter_mapping
 *         readonly object time_dep_param_mapping
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_16model_param_keys_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_16model_param_keys_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_16model_param_keys___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_16model_param_keys___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->model_param_keys);
  __pyx_r = __pyx_v_self->model_param_keys;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4860
 *         readonly dict param_dict
 *         readonly list model_param_keys
 *         readonly object parameter_mapping             # <<<<<<<<<<<<<<
 *         readonly object time_dep_param_mapping
 *         readonly object testRate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_17parameter_mapping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_17parameter_mapping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_17parameter_mapping___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_17parameter_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->parameter_mapping);
  __pyx_r = __pyx_v_self->parameter_mapping;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4861
 *         readonly list model_param_keys
 *         readonly object parameter_mapping
 *         readonly object time_dep_param_mapping             # <<<<<<<<<<<<<<
 *         readonly object testRate
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_22time_dep_param_mapping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_22time_dep_param_mapping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_22time_dep_param_mapping___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_22time_dep_param_mapping___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->time_dep_param_mapping);
  __pyx_r = __pyx_v_self->time_dep_param_mapping;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":4862
 *         readonly object parameter_mapping
 *         readonly object time_dep_param_mapping
 *         readonly object testRate             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_8testRate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_8testRate_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_8testRate___get__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_8testRate___get__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __pyx_r = __pyx_v_self->testRate;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_16__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_16__reduce_cython__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_spec, self.nClass, self.nClassU, self.nClassUwoN, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.test_freq, self.test_pos, self.time_dep_param_mapping, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_self->nClassU); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_self->nClassUwoN); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_det); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.steps); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.vec_size); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyTuple_New(49); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_self->__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_v_self->__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_self->__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_12, 3, ((PyObject *)__pyx_v_self->__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_12, 4, ((PyObject *)__pyx_v_self->__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_12, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_12, 7, ((PyObject *)__pyx_v_self->__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_12, 8, __pyx_v_self->__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_12, 9, ((PyObject *)__pyx_v_self->__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_12, 10, ((PyObject *)__pyx_v_self->__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_12, 11, ((PyObject *)__pyx_v_self->__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_12, 12, __pyx_v_self->__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_12, 13, ((PyObject *)__pyx_v_self->__pyx_base.cols));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->constant_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->constant_terms));
  PyTuple_SET_ITEM(__pyx_t_12, 14, ((PyObject *)__pyx_v_self->constant_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_12, 15, __pyx_v_self->__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_12, 16, __pyx_v_self->__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->det_model));
  PyTuple_SET_ITEM(__pyx_t_12, 17, ((PyObject *)__pyx_v_self->det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_12, 18, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_12, 19, ((PyObject *)__pyx_v_self->__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_12, 20, ((PyObject *)__pyx_v_self->__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_12, 21, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_12, 22, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_12, 23, ((PyObject *)__pyx_v_self->__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_12, 24, ((PyObject *)__pyx_v_self->__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_12, 25, ((PyObject *)__pyx_v_self->__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_12, 26, ((PyObject *)__pyx_v_self->__pyx_base.gIs));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->infection_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->infection_terms));
  PyTuple_SET_ITEM(__pyx_t_12, 27, ((PyObject *)__pyx_v_self->infection_terms));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->linear_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->linear_terms));
  PyTuple_SET_ITEM(__pyx_t_12, 28, ((PyObject *)__pyx_v_self->linear_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_12, 29, __pyx_v_self->__pyx_base.lyapunov_method);
  __Pyx_INCREF(__pyx_v_self->model_param_keys);
  __Pyx_GIVEREF(__pyx_v_self->model_param_keys);
  PyTuple_SET_ITEM(__pyx_t_12, 30, __pyx_v_self->model_param_keys);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->model_parameters));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->model_parameters));
  PyTuple_SET_ITEM(__pyx_t_12, 31, ((PyObject *)__pyx_v_self->model_parameters));
  __Pyx_INCREF(__pyx_v_self->model_spec);
  __Pyx_GIVEREF(__pyx_v_self->model_spec);
  PyTuple_SET_ITEM(__pyx_t_12, 32, __pyx_v_self->model_spec);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_12, 33, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_12, 34, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_12, 35, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->param_dict);
  __Pyx_GIVEREF(__pyx_v_self->param_dict);
  PyTuple_SET_ITEM(__pyx_t_12, 36, __pyx_v_self->param_dict);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_12, 37, __pyx_v_self->__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_12, 38, __pyx_t_7);
  __Pyx_INCREF(__pyx_v_self->parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_self->parameter_mapping);
  PyTuple_SET_ITEM(__pyx_t_12, 39, __pyx_v_self->parameter_mapping);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_12, 40, ((PyObject *)__pyx_v_self->__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_12, 41, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_12, 42, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_12, 43, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_self->testRate);
  __Pyx_GIVEREF(__pyx_v_self->testRate);
  PyTuple_SET_ITEM(__pyx_t_12, 44, __pyx_v_self->testRate);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->test_freq));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->test_freq));
  PyTuple_SET_ITEM(__pyx_t_12, 45, ((PyObject *)__pyx_v_self->test_freq));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->test_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->test_pos));
  PyTuple_SET_ITEM(__pyx_t_12, 46, ((PyObject *)__pyx_v_self->test_pos));
  __Pyx_INCREF(__pyx_v_self->time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_self->time_dep_param_mapping);
  PyTuple_SET_ITEM(__pyx_t_12, 47, __pyx_v_self->time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_12, 48, __pyx_t_11);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_spec, self.nClass, self.nClassU, self.nClassUwoN, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.test_freq, self.test_pos, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_12 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_v__dict = __pyx_t_12;
  __pyx_t_12 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_spec, self.nClass, self.nClassU, self.nClassUwoN, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.test_freq, self.test_pos, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_13 = (__pyx_v__dict != Py_None);
  __pyx_t_14 = (__pyx_t_13 != 0);
  if (__pyx_t_14) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v__dict);
    __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_11));
    __pyx_t_11 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.rows is not None or self.testRate is not None or self.test_freq is not None or self.test_pos is not None or self.time_dep_param_mapping is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_spec, self.nClass, self.nClassU, self.nClassUwoN, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.testRate, self.test_freq, self.test_pos, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.rows is not None or self.testRate is not None or self.test_freq is not None or self.test_pos is not None or self.time_dep_param_mapping is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, None), state
 */
  /*else*/ {
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.B) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.B_vec) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.CM) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.J) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.J_mat) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.U) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base._xm) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.alpha) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.beta) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.cols) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->constant_terms) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (__pyx_v_self->__pyx_base.contactMatrix != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->det_model) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.dsigmadt) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.fi) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices1) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.flat_indices2) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.fsa) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.gIa) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.gIs) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->infection_terms) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->linear_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (__pyx_v_self->model_param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->model_parameters) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (__pyx_v_self->model_spec != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->param_dict != ((PyObject*)Py_None));
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (__pyx_v_self->__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->parameter_mapping != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->__pyx_base.rows) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->testRate != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (((PyObject *)__pyx_v_self->test_freq) != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->test_pos) != Py_None);
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_14 = __pyx_t_15;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_15 = (__pyx_v_self->time_dep_param_mapping != Py_None);
    __pyx_t_13 = (__pyx_t_15 != 0);
    __pyx_t_14 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_14;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.rows is not None or self.testRate is not None or self.test_freq is not None or self.test_pos is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, None), state
 *     else:
 */
  __pyx_t_14 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_14) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.rows is not None or self.testRate is not None or self.test_freq is not None or self.test_pos is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pyx_unpickle_SppQ_old); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_96728239);
    __Pyx_GIVEREF(__pyx_int_96728239);
    PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_96728239);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_12, 2, Py_None);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.rows is not None or self.testRate is not None or self.test_freq is not None or self.test_pos is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, None), state
 *     else:
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SppQ_old__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pyx_unpickle_SppQ_old); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_96728239);
    __Pyx_GIVEREF(__pyx_int_96728239);
    PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_96728239);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_state);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
    __pyx_t_10 = 0;
    __pyx_t_12 = 0;
    __pyx_r = __pyx_t_11;
    __pyx_t_11 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SppQ_old__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_8SppQ_old_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_8SppQ_old_18__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8SppQ_old_18__setstate_cython__(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SppQ_old__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SppQ_old__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SppQ_old, (type(self), 0x5c3f4af, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SppQ_old__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppQ_old.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyross/inference.pyx":5234
 * cdef class SppSparse(Spp):
 * 
 *     def __init__(self, model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                 det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3,
 *                 parameter_mapping=None, time_dep_param_mapping=None):
 */

/* Python wrapper */
static int __pyx_pw_6pyross_9inference_9SppSparse_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pyross_9inference_9SppSparse_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_model_spec = 0;
  PyObject *__pyx_v_contact_matrix0 = 0;
  PyObject *__pyx_v_contact_matrix_threshold = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_fi = 0;
  PyObject *__pyx_v_Omega = 0;
  PyObject *__pyx_v_steps = 0;
  PyObject *__pyx_v_det_method = 0;
  PyObject *__pyx_v_lyapunov_method = 0;
  PyObject *__pyx_v_rtol_det = 0;
  PyObject *__pyx_v_rtol_lyapunov = 0;
  PyObject *__pyx_v_parameter_mapping = 0;
  PyObject *__pyx_v_time_dep_param_mapping = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_model_spec,&__pyx_n_s_contact_matrix0,&__pyx_n_s_contact_matrix_threshold,&__pyx_n_s_parameters,&__pyx_n_s_M,&__pyx_n_s_fi,&__pyx_n_s_Omega,&__pyx_n_s_steps,&__pyx_n_s_det_method,&__pyx_n_s_lyapunov_method,&__pyx_n_s_rtol_det,&__pyx_n_s_rtol_lyapunov,&__pyx_n_s_parameter_mapping,&__pyx_n_s_time_dep_param_mapping,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[6] = ((PyObject *)__pyx_int_1);
    values[7] = ((PyObject *)__pyx_int_4);
    values[8] = ((PyObject *)__pyx_n_u_LSODA);
    values[9] = ((PyObject *)__pyx_n_u_LSODA);
    values[10] = ((PyObject *)__pyx_float_1eneg_3);
    values[11] = ((PyObject *)__pyx_float_1eneg_3);

    /* "pyross/inference.pyx":5236
 *     def __init__(self, model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi, Omega=1, steps=4,
 *                 det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3,
 *                 parameter_mapping=None, time_dep_param_mapping=None):             # <<<<<<<<<<<<<<
 * 
 *         super().__init__(model_spec, parameters, M, fi, Omega, steps,
 */
    values[12] = ((PyObject *)Py_None);
    values[13] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model_spec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contact_matrix0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 14, 1); __PYX_ERR(0, 5234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_contact_matrix_threshold)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 14, 2); __PYX_ERR(0, 5234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 14, 3); __PYX_ERR(0, 5234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 14, 4); __PYX_ERR(0, 5234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 14, 5); __PYX_ERR(0, 5234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Omega);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_det_method);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lyapunov_method);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_det);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtol_lyapunov);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameter_mapping);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_time_dep_param_mapping);
          if (value) { values[13] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 5234, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_model_spec = values[0];
    __pyx_v_contact_matrix0 = values[1];
    __pyx_v_contact_matrix_threshold = values[2];
    __pyx_v_parameters = values[3];
    __pyx_v_M = values[4];
    __pyx_v_fi = values[5];
    __pyx_v_Omega = values[6];
    __pyx_v_steps = values[7];
    __pyx_v_det_method = values[8];
    __pyx_v_lyapunov_method = values[9];
    __pyx_v_rtol_det = values[10];
    __pyx_v_rtol_lyapunov = values[11];
    __pyx_v_parameter_mapping = values[12];
    __pyx_v_time_dep_param_mapping = values[13];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 5234, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.SppSparse.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_9SppSparse___init__(((struct __pyx_obj_6pyross_9inference_SppSparse *)__pyx_v_self), __pyx_v_model_spec, __pyx_v_contact_matrix0, __pyx_v_contact_matrix_threshold, __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov, __pyx_v_parameter_mapping, __pyx_v_time_dep_param_mapping);

  /* "pyross/inference.pyx":5234
 * cdef class SppSparse(Spp):
 * 
 *     def __init__(self, model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                 det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3,
 *                 parameter_mapping=None, time_dep_param_mapping=None):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pyross_9inference_9SppSparse___init__(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v_self, PyObject *__pyx_v_model_spec, PyObject *__pyx_v_contact_matrix0, PyObject *__pyx_v_contact_matrix_threshold, PyObject *__pyx_v_parameters, PyObject *__pyx_v_M, PyObject *__pyx_v_fi, PyObject *__pyx_v_Omega, PyObject *__pyx_v_steps, PyObject *__pyx_v_det_method, PyObject *__pyx_v_lyapunov_method, PyObject *__pyx_v_rtol_det, PyObject *__pyx_v_rtol_lyapunov, PyObject *__pyx_v_parameter_mapping, PyObject *__pyx_v_time_dep_param_mapping) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_parameters);

  /* "pyross/inference.pyx":5238
 *                 parameter_mapping=None, time_dep_param_mapping=None):
 * 
 *         super().__init__(model_spec, parameters, M, fi, Omega, steps,             # <<<<<<<<<<<<<<
 *                 det_method, lyapunov_method, rtol_det, rtol_lyapunov,
 *                 parameter_mapping, time_dep_param_mapping)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_6pyross_9inference_SppSparse));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6pyross_9inference_SppSparse));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6pyross_9inference_SppSparse));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyross/inference.pyx":5240
 *         super().__init__(model_spec, parameters, M, fi, Omega, steps,
 *                 det_method, lyapunov_method, rtol_det, rtol_lyapunov,
 *                 parameter_mapping, time_dep_param_mapping)             # <<<<<<<<<<<<<<
 * 
 *         if self.parameter_mapping is not None:
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_model_spec, __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov, __pyx_v_parameter_mapping, __pyx_v_time_dep_param_mapping};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5238, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_model_spec, __pyx_v_parameters, __pyx_v_M, __pyx_v_fi, __pyx_v_Omega, __pyx_v_steps, __pyx_v_det_method, __pyx_v_lyapunov_method, __pyx_v_rtol_det, __pyx_v_rtol_lyapunov, __pyx_v_parameter_mapping, __pyx_v_time_dep_param_mapping};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5238, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(12+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_M);
    __Pyx_INCREF(__pyx_v_fi);
    __Pyx_GIVEREF(__pyx_v_fi);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_fi);
    __Pyx_INCREF(__pyx_v_Omega);
    __Pyx_GIVEREF(__pyx_v_Omega);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_Omega);
    __Pyx_INCREF(__pyx_v_steps);
    __Pyx_GIVEREF(__pyx_v_steps);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_steps);
    __Pyx_INCREF(__pyx_v_det_method);
    __Pyx_GIVEREF(__pyx_v_det_method);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_det_method);
    __Pyx_INCREF(__pyx_v_lyapunov_method);
    __Pyx_GIVEREF(__pyx_v_lyapunov_method);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_lyapunov_method);
    __Pyx_INCREF(__pyx_v_rtol_det);
    __Pyx_GIVEREF(__pyx_v_rtol_det);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_rtol_det);
    __Pyx_INCREF(__pyx_v_rtol_lyapunov);
    __Pyx_GIVEREF(__pyx_v_rtol_lyapunov);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_rtol_lyapunov);
    __Pyx_INCREF(__pyx_v_parameter_mapping);
    __Pyx_GIVEREF(__pyx_v_parameter_mapping);
    PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_parameter_mapping);
    __Pyx_INCREF(__pyx_v_time_dep_param_mapping);
    __Pyx_GIVEREF(__pyx_v_time_dep_param_mapping);
    PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_time_dep_param_mapping);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":5242
 *                 parameter_mapping, time_dep_param_mapping)
 * 
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 */
  __pyx_t_6 = (__pyx_v_self->__pyx_base.parameter_mapping != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "pyross/inference.pyx":5243
 * 
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)             # <<<<<<<<<<<<<<
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:
 */
    __Pyx_INCREF(__pyx_v_self->__pyx_base.parameter_mapping);
    __pyx_t_2 = __pyx_v_self->__pyx_base.parameter_mapping; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_parameters);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_parameters, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyross/inference.pyx":5244
 *         if self.parameter_mapping is not None:
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True             # <<<<<<<<<<<<<<
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 */
    __pyx_v_self->__pyx_base.__pyx_base.param_mapping_enabled = 1;

    /* "pyross/inference.pyx":5242
 *                 parameter_mapping, time_dep_param_mapping)
 * 
 *         if self.parameter_mapping is not None:             # <<<<<<<<<<<<<<
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 */
  }

  /* "pyross/inference.pyx":5245
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *             self.param_mapping_enabled = True
 */
  __pyx_t_7 = (__pyx_v_self->__pyx_base.time_dep_param_mapping != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "pyross/inference.pyx":5246
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)             # <<<<<<<<<<<<<<
 *             self.param_mapping_enabled = True
 *         else:
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_fi, __pyx_v_Omega); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_contact_matrix0);
    __Pyx_GIVEREF(__pyx_v_contact_matrix0);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_contact_matrix0);
    __Pyx_INCREF(__pyx_v_contact_matrix_threshold);
    __Pyx_GIVEREF(__pyx_v_contact_matrix_threshold);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_contact_matrix_threshold);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_M);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_time_dep_param_mapping, __pyx_v_time_dep_param_mapping) < 0) __PYX_ERR(0, 5246, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SppSparse), __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.det_model);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.det_model));
    __pyx_v_self->__pyx_base.det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyross/inference.pyx":5247
 *         if self.time_dep_param_mapping is not None:
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *             self.param_mapping_enabled = True             # <<<<<<<<<<<<<<
 *         else:
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega)
 */
    __pyx_v_self->__pyx_base.__pyx_base.param_mapping_enabled = 1;

    /* "pyross/inference.pyx":5245
 *             parameters = self.parameter_mapping(parameters)
 *             self.param_mapping_enabled = True
 *         if self.time_dep_param_mapping is not None:             # <<<<<<<<<<<<<<
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega, time_dep_param_mapping=time_dep_param_mapping)
 *             self.param_mapping_enabled = True
 */
    goto __pyx_L4;
  }

  /* "pyross/inference.pyx":5249
 *             self.param_mapping_enabled = True
 *         else:
 *             self.det_model = pyross.deterministic.SppSparse(model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi*Omega)             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_fi, __pyx_v_Omega); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_model_spec);
    __Pyx_GIVEREF(__pyx_v_model_spec);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_model_spec);
    __Pyx_INCREF(__pyx_v_contact_matrix0);
    __Pyx_GIVEREF(__pyx_v_contact_matrix0);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_contact_matrix0);
    __Pyx_INCREF(__pyx_v_contact_matrix_threshold);
    __Pyx_GIVEREF(__pyx_v_contact_matrix_threshold);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_contact_matrix_threshold);
    __Pyx_INCREF(__pyx_v_parameters);
    __Pyx_GIVEREF(__pyx_v_parameters);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_parameters);
    __Pyx_INCREF(__pyx_v_M);
    __Pyx_GIVEREF(__pyx_v_M);
    PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_M);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pyross_13deterministic_SppSparse), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.det_model);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.det_model));
    __pyx_v_self->__pyx_base.det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L4:;

  /* "pyross/inference.pyx":5234
 * cdef class SppSparse(Spp):
 * 
 *     def __init__(self, model_spec, contact_matrix0, contact_matrix_threshold, parameters, M, fi, Omega=1, steps=4,             # <<<<<<<<<<<<<<
 *                 det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3,
 *                 parameter_mapping=None, time_dep_param_mapping=None):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.SppSparse.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parameters);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_9SppSparse_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_9SppSparse_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_9SppSparse_2__reduce_cython__(((struct __pyx_obj_6pyross_9inference_SppSparse *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_9SppSparse_2__reduce_cython__(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.M); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.Omega); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.nClass); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.__pyx_base.param_mapping_enabled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.rtol_det); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.rtol_lyapunov); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.steps); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.__pyx_base.vec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(48); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J));
  PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat));
  PyTuple_SET_ITEM(__pyx_t_10, 4, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base._interp);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base._interp);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->__pyx_base.__pyx_base._interp);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm));
  PyTuple_SET_ITEM(__pyx_t_10, 9, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta));
  PyTuple_SET_ITEM(__pyx_t_10, 11, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.class_index_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.class_index_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_v_self->__pyx_base.__pyx_base.class_index_dict);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols));
  PyTuple_SET_ITEM(__pyx_t_10, 13, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.constant_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.constant_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 14, ((PyObject *)__pyx_v_self->__pyx_base.constant_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.contactMatrix);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.contactMatrix);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->__pyx_base.__pyx_base.contactMatrix);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.det_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.det_method);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_v_self->__pyx_base.__pyx_base.det_method);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.det_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.det_model));
  PyTuple_SET_ITEM(__pyx_t_10, 17, ((PyObject *)__pyx_v_self->__pyx_base.det_model));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt));
  PyTuple_SET_ITEM(__pyx_t_10, 19, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi));
  PyTuple_SET_ITEM(__pyx_t_10, 20, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.finres_pop));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.finres_pop));
  PyTuple_SET_ITEM(__pyx_t_10, 21, ((PyObject *)__pyx_v_self->__pyx_base.finres_pop));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.finres_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.finres_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 22, ((PyObject *)__pyx_v_self->__pyx_base.finres_terms));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices));
  PyTuple_SET_ITEM(__pyx_t_10, 23, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1));
  PyTuple_SET_ITEM(__pyx_t_10, 24, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2));
  PyTuple_SET_ITEM(__pyx_t_10, 25, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa));
  PyTuple_SET_ITEM(__pyx_t_10, 26, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa));
  PyTuple_SET_ITEM(__pyx_t_10, 27, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs));
  PyTuple_SET_ITEM(__pyx_t_10, 28, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.infection_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.infection_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 29, ((PyObject *)__pyx_v_self->__pyx_base.infection_terms));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.linear_terms));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.linear_terms));
  PyTuple_SET_ITEM(__pyx_t_10, 30, ((PyObject *)__pyx_v_self->__pyx_base.linear_terms));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.lyapunov_method);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.lyapunov_method);
  PyTuple_SET_ITEM(__pyx_t_10, 31, __pyx_v_self->__pyx_base.__pyx_base.lyapunov_method);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.model_param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.model_param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 32, __pyx_v_self->__pyx_base.model_param_keys);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters));
  PyTuple_SET_ITEM(__pyx_t_10, 33, ((PyObject *)__pyx_v_self->__pyx_base.model_parameters));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length));
  PyTuple_SET_ITEM(__pyx_t_10, 34, ((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.model_spec);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.model_spec);
  PyTuple_SET_ITEM(__pyx_t_10, 35, __pyx_v_self->__pyx_base.model_spec);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 36, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.param_dict);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.param_dict);
  PyTuple_SET_ITEM(__pyx_t_10, 37, __pyx_v_self->__pyx_base.param_dict);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.param_keys);
  PyTuple_SET_ITEM(__pyx_t_10, 38, __pyx_v_self->__pyx_base.__pyx_base.param_keys);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 39, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.parameter_mapping);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.parameter_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 40, __pyx_v_self->__pyx_base.parameter_mapping);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.resource_list));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.resource_list));
  PyTuple_SET_ITEM(__pyx_t_10, 41, ((PyObject *)__pyx_v_self->__pyx_base.resource_list));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows));
  PyTuple_SET_ITEM(__pyx_t_10, 42, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 43, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 44, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 45, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.time_dep_param_mapping);
  PyTuple_SET_ITEM(__pyx_t_10, 46, __pyx_v_self->__pyx_base.time_dep_param_mapping);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 47, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.B, self.B_vec, self.CM, self.J, self.J_mat, self.M, self.Omega, self.U, self._interp, self._xm, self.alpha, self.beta, self.class_index_dict, self.cols, self.constant_terms, self.contactMatrix, self.det_method, self.det_model, self.dim, self.dsigmadt, self.fi, self.finres_pop, self.finres_terms, self.flat_indices, self.flat_indices1, self.flat_indices2, self.fsa, self.gIa, self.gIs, self.infection_terms, self.linear_terms, self.lyapunov_method, self.model_param_keys, self.model_parameters, self.model_parameters_length, self.model_spec, self.nClass, self.param_dict, self.param_keys, self.param_mapping_enabled, self.parameter_mapping, self.resource_list, self.rows, self.rtol_det, self.rtol_lyapunov, self.steps, self.time_dep_param_mapping, self.vec_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, None), state
 */
  /*else*/ {
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.B_vec) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.CM) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.J_mat) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.U) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base._interp != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._xm) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.alpha) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.beta) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base.class_index_dict != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.cols) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.constant_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.__pyx_base.contactMatrix != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base.det_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.det_model) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.dsigmadt) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fi) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.finres_pop) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.finres_terms) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices1) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.flat_indices2) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.fsa) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIa) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.gIs) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.infection_terms) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.linear_terms) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base.lyapunov_method != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.model_param_keys != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.model_parameters) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.model_parameters_length) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.model_spec != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.param_dict != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.__pyx_base.param_keys != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->__pyx_base.parameter_mapping != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->__pyx_base.resource_list) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.rows) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->__pyx_base.time_dep_param_mapping != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_SppSparse); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_6898761);
    __Pyx_GIVEREF(__pyx_int_6898761);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_6898761);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.B is not None or self.B_vec is not None or self.CM is not None or self.J is not None or self.J_mat is not None or self.U is not None or self._interp is not None or self._xm is not None or self.alpha is not None or self.beta is not None or self.class_index_dict is not None or self.cols is not None or self.constant_terms is not None or self.contactMatrix is not None or self.det_method is not None or self.det_model is not None or self.dsigmadt is not None or self.fi is not None or self.finres_pop is not None or self.finres_terms is not None or self.flat_indices is not None or self.flat_indices1 is not None or self.flat_indices2 is not None or self.fsa is not None or self.gIa is not None or self.gIs is not None or self.infection_terms is not None or self.linear_terms is not None or self.lyapunov_method is not None or self.model_param_keys is not None or self.model_parameters is not None or self.model_parameters_length is not None or self.model_spec is not None or self.param_dict is not None or self.param_keys is not None or self.parameter_mapping is not None or self.resource_list is not None or self.rows is not None or self.time_dep_param_mapping is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, None), state
 *     else:
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SppSparse__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_SppSparse); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_6898761);
    __Pyx_GIVEREF(__pyx_int_6898761);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_6898761);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyross.inference.SppSparse.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SppSparse__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_9SppSparse_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pyross_9inference_9SppSparse_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pyross_9inference_9SppSparse_4__setstate_cython__(((struct __pyx_obj_6pyross_9inference_SppSparse *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_9SppSparse_4__setstate_cython__(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_SppSparse__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pyross_9inference___pyx_unpickle_SppSparse__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_SppSparse, (type(self), 0x0694449, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_SppSparse__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyross.inference.SppSparse.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SIR_type(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_1__pyx_unpickle_SIR_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_1__pyx_unpickle_SIR_type = {"__pyx_unpickle_SIR_type", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_1__pyx_unpickle_SIR_type, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_1__pyx_unpickle_SIR_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SIR_type (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SIR_type", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SIR_type", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SIR_type") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SIR_type", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SIR_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference___pyx_unpickle_SIR_type(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference___pyx_unpickle_SIR_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SIR_type", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xa4092e4:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xa4092e4) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xa4092e4:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR_type.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xa4092e4:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SIR_type.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xa4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xa4092e4:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR_type.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SIR_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR_type.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SIR_type.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SIR_type__set_state(((struct __pyx_obj_6pyross_9inference_SIR_type *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xa4092e4 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR_type.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SIR_type(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SIR_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SIR_type__set_state(struct __pyx_obj_6pyross_9inference_SIR_type *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SIR_type__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[34])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->B));
  __pyx_v___pyx_result->B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->B_vec));
  __pyx_v___pyx_result->B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->CM));
  __pyx_v___pyx_result->CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->J));
  __pyx_v___pyx_result->J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->J_mat));
  __pyx_v___pyx_result->J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->U));
  __pyx_v___pyx_result->U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_interp);
  __Pyx_DECREF(__pyx_v___pyx_result->_interp);
  __pyx_v___pyx_result->_interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->_xm));
  __pyx_v___pyx_result->_xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->alpha));
  __pyx_v___pyx_result->alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->beta));
  __pyx_v___pyx_result->beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->class_index_dict);
  __pyx_v___pyx_result->class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->cols));
  __pyx_v___pyx_result->cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->contactMatrix);
  __pyx_v___pyx_result->contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->det_method);
  __pyx_v___pyx_result->det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->dsigmadt));
  __pyx_v___pyx_result->dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->fi));
  __pyx_v___pyx_result->fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->flat_indices));
  __pyx_v___pyx_result->flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->flat_indices1));
  __pyx_v___pyx_result->flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->flat_indices2));
  __pyx_v___pyx_result->flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->fsa));
  __pyx_v___pyx_result->fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gIa));
  __pyx_v___pyx_result->gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gIs));
  __pyx_v___pyx_result->gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->lyapunov_method);
  __pyx_v___pyx_result->lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->param_keys);
  __pyx_v___pyx_result->param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->rows));
  __pyx_v___pyx_result->rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[34])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 34) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[34])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[34])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SIR_type__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SIR(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_3__pyx_unpickle_SIR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_3__pyx_unpickle_SIR = {"__pyx_unpickle_SIR", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_3__pyx_unpickle_SIR, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_3__pyx_unpickle_SIR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SIR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SIR", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SIR", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SIR") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SIR", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SIR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_2__pyx_unpickle_SIR(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_2__pyx_unpickle_SIR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SIR", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xe4842b7:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xe4842b7) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xe4842b7:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xe4842b7:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SIR.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xe4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xe4842b7:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SIR), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SIR.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SIR__set_state(((struct __pyx_obj_6pyross_9inference_SIR *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xe4842b7 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SIR.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SIR(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SIR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]
 *     if len(__pyx_state) > 35 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SIR__set_state(struct __pyx_obj_6pyross_9inference_SIR *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SIR__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 35 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[35])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_SIR))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->det_model));
  __pyx_v___pyx_result->det_model = ((struct __pyx_obj_6pyross_13deterministic_SIR *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]
 *     if len(__pyx_state) > 35 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[35])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 35) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]
 *     if len(__pyx_state) > 35 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[35])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]
 *     if len(__pyx_state) > 35 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[35])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SIR__set_state(<SIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR__set_state(SIR __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gIa = __pyx_state[24]; __pyx_result.gIs = __pyx_state[25]; __pyx_result.lyapunov_method = __pyx_state[26]; __pyx_result.nClass = __pyx_state[27]; __pyx_result.param_keys = __pyx_state[28]; __pyx_result.param_mapping_enabled = __pyx_state[29]; __pyx_result.rows = __pyx_state[30]; __pyx_result.rtol_det = __pyx_state[31]; __pyx_result.rtol_lyapunov = __pyx_state[32]; __pyx_result.steps = __pyx_state[33]; __pyx_result.vec_size = __pyx_state[34]
 *     if len(__pyx_state) > 35 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SIR__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SEIR(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_5__pyx_unpickle_SEIR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_5__pyx_unpickle_SEIR = {"__pyx_unpickle_SEIR", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_5__pyx_unpickle_SEIR, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_5__pyx_unpickle_SEIR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEIR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEIR", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEIR", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SEIR") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEIR", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEIR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_4__pyx_unpickle_SEIR(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_4__pyx_unpickle_SEIR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEIR", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc2c4cf:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xdc2c4cf) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc2c4cf:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEIR.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xdc2c4cf:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SEIR.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xdc, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc2c4cf:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEIR.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SEIR), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEIR.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SEIR.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SEIR__set_state(((struct __pyx_obj_6pyross_9inference_SEIR *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc2c4cf = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEIR.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SEIR(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEIR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SEIR__set_state(struct __pyx_obj_6pyross_9inference_SEIR *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEIR__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[36])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_SEIR))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->det_model));
  __pyx_v___pyx_result->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEIR *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gE);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gE));
  __pyx_v___pyx_result->gE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[36])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 36) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[36])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[36])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEIR__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SEAIRQ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_7__pyx_unpickle_SEAIRQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_7__pyx_unpickle_SEAIRQ = {"__pyx_unpickle_SEAIRQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_7__pyx_unpickle_SEAIRQ, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_7__pyx_unpickle_SEAIRQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEAIRQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEAIRQ", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEAIRQ", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SEAIRQ") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEAIRQ", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEAIRQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_6__pyx_unpickle_SEAIRQ(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_6__pyx_unpickle_SEAIRQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEAIRQ", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2943728:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x2943728) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2943728:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x2943728:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SEAIRQ.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x29, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2943728:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SEAIRQ.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ__set_state(((struct __pyx_obj_6pyross_9inference_SEAIRQ *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2943728 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, tA, tE, tIa, tIs, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SEAIRQ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEAIRQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ__set_state(struct __pyx_obj_6pyross_9inference_SEAIRQ *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEAIRQ__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[41])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_SEAIRQ))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->det_model));
  __pyx_v___pyx_result->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gA);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gA));
  __pyx_v___pyx_result->gA = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gE);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gE));
  __pyx_v___pyx_result->gE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tA);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tA));
  __pyx_v___pyx_result->tA = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tE);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tE));
  __pyx_v___pyx_result->tE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tIa));
  __pyx_v___pyx_result->tIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tIs));
  __pyx_v___pyx_result->tIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[41])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 41) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[41])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 41, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[41])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SEAIRQ__set_state(<SEAIRQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ__set_state(SEAIRQ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gA = __pyx_state[24]; __pyx_result.gE = __pyx_state[25]; __pyx_result.gIa = __pyx_state[26]; __pyx_result.gIs = __pyx_state[27]; __pyx_result.lyapunov_method = __pyx_state[28]; __pyx_result.nClass = __pyx_state[29]; __pyx_result.param_keys = __pyx_state[30]; __pyx_result.param_mapping_enabled = __pyx_state[31]; __pyx_result.rows = __pyx_state[32]; __pyx_result.rtol_det = __pyx_state[33]; __pyx_result.rtol_lyapunov = __pyx_state[34]; __pyx_result.steps = __pyx_state[35]; __pyx_result.tA = __pyx_state[36]; __pyx_result.tE = __pyx_state[37]; __pyx_result.tIa = __pyx_state[38]; __pyx_result.tIs = __pyx_state[39]; __pyx_result.vec_size = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEAIRQ__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SEAIRQ_testing(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_9__pyx_unpickle_SEAIRQ_testing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_9__pyx_unpickle_SEAIRQ_testing = {"__pyx_unpickle_SEAIRQ_testing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_9__pyx_unpickle_SEAIRQ_testing, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_9__pyx_unpickle_SEAIRQ_testing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEAIRQ_testing (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEAIRQ_testing", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEAIRQ_testing", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SEAIRQ_testing") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SEAIRQ_testing", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEAIRQ_testing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_8__pyx_unpickle_SEAIRQ_testing(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_8__pyx_unpickle_SEAIRQ_testing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEAIRQ_testing", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x162d02e:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x162d02e) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x162d02e:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ_testing.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x162d02e:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SEAIRQ_testing.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x16, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x162d02e:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ_testing.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SEAIRQ_testing), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ_testing.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SEAIRQ_testing.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ_testing__set_state(((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x162d02e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, ars, beta, class_index_dict, cols, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gA, gE, gIa, gIs, kapE, lyapunov_method, nClass, param_keys, param_mapping_enabled, rows, rtol_det, rtol_lyapunov, steps, testRate, vec_size))" % __pyx_checksum)
 *     __pyx_result = SEAIRQ_testing.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SEAIRQ_testing(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEAIRQ_testing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SEAIRQ_testing__set_state(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SEAIRQ_testing__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[40])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->ars);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->ars));
  __pyx_v___pyx_result->ars = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_SEAIRQ_testing))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->det_model));
  __pyx_v___pyx_result->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gA);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gA));
  __pyx_v___pyx_result->gA = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->gE);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->gE));
  __pyx_v___pyx_result->gE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->kapE);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->kapE));
  __pyx_v___pyx_result->kapE = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->testRate);
  __Pyx_DECREF(__pyx_v___pyx_result->testRate);
  __pyx_v___pyx_result->testRate = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[40])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 40) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[40])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[40])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SEAIRQ_testing__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Spp(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_11__pyx_unpickle_Spp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_11__pyx_unpickle_Spp = {"__pyx_unpickle_Spp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_11__pyx_unpickle_Spp, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_11__pyx_unpickle_Spp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Spp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Spp", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Spp", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Spp") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Spp", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_Spp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_10__pyx_unpickle_Spp(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_10__pyx_unpickle_Spp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Spp", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0694449:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x0694449) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0694449:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = Spp.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x0694449:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Spp.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x06, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0694449:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = Spp.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_Spp), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = Spp.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Spp.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_Spp__set_state(((struct __pyx_obj_6pyross_9inference_Spp *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = Spp.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Spp(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_Spp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_Spp__set_state(struct __pyx_obj_6pyross_9inference_Spp *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Spp__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[48])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->constant_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->constant_terms));
  __pyx_v___pyx_result->constant_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_Spp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->det_model));
  __pyx_v___pyx_result->det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->finres_pop);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->finres_pop));
  __pyx_v___pyx_result->finres_pop = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->finres_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->finres_terms));
  __pyx_v___pyx_result->finres_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->infection_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->infection_terms));
  __pyx_v___pyx_result->infection_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->linear_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->linear_terms));
  __pyx_v___pyx_result->linear_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->model_param_keys);
  __pyx_v___pyx_result->model_param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_parameters);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->model_parameters));
  __pyx_v___pyx_result->model_parameters = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_parameters_length);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->model_parameters_length));
  __pyx_v___pyx_result->model_parameters_length = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_spec);
  __Pyx_DECREF(__pyx_v___pyx_result->model_spec);
  __pyx_v___pyx_result->model_spec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->param_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->param_dict);
  __pyx_v___pyx_result->param_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->parameter_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->parameter_mapping);
  __pyx_v___pyx_result->parameter_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 41, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->resource_list);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->resource_list));
  __pyx_v___pyx_result->resource_list = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 42, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 43, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 44, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 45, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 46, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->time_dep_param_mapping);
  __pyx_v___pyx_result->time_dep_param_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 47, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[48])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 48) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[48])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 48, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[48])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Spp__set_state(<Spp> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Spp__set_state(Spp __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_Spp__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SppQ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_13__pyx_unpickle_SppQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_13__pyx_unpickle_SppQ = {"__pyx_unpickle_SppQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_13__pyx_unpickle_SppQ, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_13__pyx_unpickle_SppQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppQ", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppQ", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SppQ") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppQ", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_12__pyx_unpickle_SppQ(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_12__pyx_unpickle_SppQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppQ", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x166e26e:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x166e26e) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x166e26e:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x166e26e:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SppQ.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x16_2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x166e26e:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SppQ), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SppQ.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SppQ__set_state(((struct __pyx_obj_6pyross_9inference_SppQ *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x166e26e = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, full_model_spec, gIa, gIs, infection_terms, input_param_mapping, input_time_dep_param_mapping, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, testRate, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SppQ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SppQ__set_state(struct __pyx_obj_6pyross_9inference_SppQ *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppQ__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[52])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base.__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base.__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.constant_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.constant_terms));
  __pyx_v___pyx_result->__pyx_base.constant_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_Spp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.det_model));
  __pyx_v___pyx_result->__pyx_base.det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.finres_pop);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.finres_pop));
  __pyx_v___pyx_result->__pyx_base.finres_pop = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.finres_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.finres_terms));
  __pyx_v___pyx_result->__pyx_base.finres_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->full_model_spec);
  __Pyx_DECREF(__pyx_v___pyx_result->full_model_spec);
  __pyx_v___pyx_result->full_model_spec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.infection_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.infection_terms));
  __pyx_v___pyx_result->__pyx_base.infection_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->input_param_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->input_param_mapping);
  __pyx_v___pyx_result->input_param_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->input_time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->input_time_dep_param_mapping);
  __pyx_v___pyx_result->input_time_dep_param_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.linear_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.linear_terms));
  __pyx_v___pyx_result->__pyx_base.linear_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.model_param_keys);
  __pyx_v___pyx_result->__pyx_base.model_param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_parameters);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.model_parameters));
  __pyx_v___pyx_result->__pyx_base.model_parameters = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_parameters_length);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.model_parameters_length));
  __pyx_v___pyx_result->__pyx_base.model_parameters_length = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_spec);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.model_spec);
  __pyx_v___pyx_result->__pyx_base.model_spec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_dict);
  __pyx_v___pyx_result->__pyx_base.param_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 41, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 42, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 43, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.parameter_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.parameter_mapping);
  __pyx_v___pyx_result->__pyx_base.parameter_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 44, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.resource_list);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.resource_list));
  __pyx_v___pyx_result->__pyx_base.resource_list = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 45, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 46, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 47, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 48, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 49, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->testRate);
  __Pyx_DECREF(__pyx_v___pyx_result->testRate);
  __pyx_v___pyx_result->testRate = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 50, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.time_dep_param_mapping);
  __pyx_v___pyx_result->__pyx_base.time_dep_param_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 51, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[52])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 52) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[52])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 52, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[52])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppQ__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SppQ_old(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_15__pyx_unpickle_SppQ_old(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_15__pyx_unpickle_SppQ_old = {"__pyx_unpickle_SppQ_old", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_15__pyx_unpickle_SppQ_old, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_15__pyx_unpickle_SppQ_old(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppQ_old (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppQ_old", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppQ_old", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SppQ_old") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppQ_old", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppQ_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_14__pyx_unpickle_SppQ_old(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_14__pyx_unpickle_SppQ_old(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppQ_old", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c3f4af:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x5c3f4af) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c3f4af:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ_old.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x5c3f4af:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SppQ_old.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x5c, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c3f4af:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ_old.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SppQ_old), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ_old.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SppQ_old.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SppQ_old__set_state(((struct __pyx_obj_6pyross_9inference_SppQ_old *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c3f4af = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_spec, nClass, nClassU, nClassUwoN, param_dict, param_keys, param_mapping_enabled, parameter_mapping, rows, rtol_det, rtol_lyapunov, steps, testRate, test_freq, test_pos, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppQ_old.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SppQ_old(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppQ_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]
 *     if len(__pyx_state) > 49 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SppQ_old__set_state(struct __pyx_obj_6pyross_9inference_SppQ_old *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppQ_old__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 49 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[49])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->constant_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->constant_terms));
  __pyx_v___pyx_result->constant_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_SppQ_old))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->det_model));
  __pyx_v___pyx_result->det_model = ((struct __pyx_obj_6pyross_13deterministic_SppQ_old *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->infection_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->infection_terms));
  __pyx_v___pyx_result->infection_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->linear_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->linear_terms));
  __pyx_v___pyx_result->linear_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->model_param_keys);
  __pyx_v___pyx_result->model_param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_parameters);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->model_parameters));
  __pyx_v___pyx_result->model_parameters = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->model_spec);
  __Pyx_DECREF(__pyx_v___pyx_result->model_spec);
  __pyx_v___pyx_result->model_spec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nClassU = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nClassUwoN = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->param_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->param_dict);
  __pyx_v___pyx_result->param_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->parameter_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->parameter_mapping);
  __pyx_v___pyx_result->parameter_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 41, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 42, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 43, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 44, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->testRate);
  __Pyx_DECREF(__pyx_v___pyx_result->testRate);
  __pyx_v___pyx_result->testRate = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 45, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->test_freq);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->test_freq));
  __pyx_v___pyx_result->test_freq = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 46, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->test_pos);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->test_pos));
  __pyx_v___pyx_result->test_pos = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 47, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->time_dep_param_mapping);
  __pyx_v___pyx_result->time_dep_param_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 48, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]
 *     if len(__pyx_state) > 49 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[49])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 49) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]
 *     if len(__pyx_state) > 49 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[49])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 49, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]
 *     if len(__pyx_state) > 49 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[49])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SppQ_old__set_state(<SppQ_old> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ_old__set_state(SppQ_old __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.infection_terms = __pyx_state[27]; __pyx_result.linear_terms = __pyx_state[28]; __pyx_result.lyapunov_method = __pyx_state[29]; __pyx_result.model_param_keys = __pyx_state[30]; __pyx_result.model_parameters = __pyx_state[31]; __pyx_result.model_spec = __pyx_state[32]; __pyx_result.nClass = __pyx_state[33]; __pyx_result.nClassU = __pyx_state[34]; __pyx_result.nClassUwoN = __pyx_state[35]; __pyx_result.param_dict = __pyx_state[36]; __pyx_result.param_keys = __pyx_state[37]; __pyx_result.param_mapping_enabled = __pyx_state[38]; __pyx_result.parameter_mapping = __pyx_state[39]; __pyx_result.rows = __pyx_state[40]; __pyx_result.rtol_det = __pyx_state[41]; __pyx_result.rtol_lyapunov = __pyx_state[42]; __pyx_result.steps = __pyx_state[43]; __pyx_result.testRate = __pyx_state[44]; __pyx_result.test_freq = __pyx_state[45]; __pyx_result.test_pos = __pyx_state[46]; __pyx_result.time_dep_param_mapping = __pyx_state[47]; __pyx_result.vec_size = __pyx_state[48]
 *     if len(__pyx_state) > 49 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppQ_old__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_SppSparse(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pyross_9inference_17__pyx_unpickle_SppSparse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pyross_9inference_17__pyx_unpickle_SppSparse = {"__pyx_unpickle_SppSparse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_17__pyx_unpickle_SppSparse, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pyross_9inference_17__pyx_unpickle_SppSparse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppSparse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppSparse", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppSparse", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SppSparse") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SppSparse", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppSparse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pyross_9inference_16__pyx_unpickle_SppSparse(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pyross_9inference_16__pyx_unpickle_SppSparse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppSparse", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0694449:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x0694449) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0694449:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppSparse.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x0694449:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = SppSparse.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x06, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0694449:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppSparse.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6pyross_9inference_SppSparse), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppSparse.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = SppSparse.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6pyross_9inference___pyx_unpickle_SppSparse__set_state(((struct __pyx_obj_6pyross_9inference_SppSparse *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0694449 = (B, B_vec, CM, J, J_mat, M, Omega, U, _interp, _xm, alpha, beta, class_index_dict, cols, constant_terms, contactMatrix, det_method, det_model, dim, dsigmadt, fi, finres_pop, finres_terms, flat_indices, flat_indices1, flat_indices2, fsa, gIa, gIs, infection_terms, linear_terms, lyapunov_method, model_param_keys, model_parameters, model_parameters_length, model_spec, nClass, param_dict, param_keys, param_mapping_enabled, parameter_mapping, resource_list, rows, rtol_det, rtol_lyapunov, steps, time_dep_param_mapping, vec_size))" % __pyx_checksum)
 *     __pyx_result = SppSparse.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SppSparse(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppSparse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_6pyross_9inference___pyx_unpickle_SppSparse__set_state(struct __pyx_obj_6pyross_9inference_SppSparse *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_SppSparse__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[48])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.B);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.B));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.B_vec);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.B_vec));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.B_vec = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.CM);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.CM));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.CM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.J);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.J));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.J = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.J_mat);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.J_mat));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.J_mat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.Omega = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.U);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.U));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.U = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._interp);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._interp);
  __pyx_v___pyx_result->__pyx_base.__pyx_base._interp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._xm);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base._xm));
  __pyx_v___pyx_result->__pyx_base.__pyx_base._xm = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.alpha);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.alpha));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.alpha = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.beta);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.beta));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.beta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.class_index_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.class_index_dict);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.class_index_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.cols);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.cols));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.constant_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.constant_terms));
  __pyx_v___pyx_result->__pyx_base.constant_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.contactMatrix);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.contactMatrix);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.contactMatrix = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.det_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.det_method);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.det_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pyross_13deterministic_Spp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.det_model);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.det_model));
  __pyx_v___pyx_result->__pyx_base.det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.dim = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.dsigmadt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.dsigmadt));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.dsigmadt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.fi);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.fi));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.fi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.finres_pop);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.finres_pop));
  __pyx_v___pyx_result->__pyx_base.finres_pop = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.finres_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.finres_terms));
  __pyx_v___pyx_result->__pyx_base.finres_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices1);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices1));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices2);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices2));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.flat_indices2 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.fsa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.fsa));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.fsa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.gIa);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.gIa));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.gIa = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.gIs);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.gIs));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.gIs = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.infection_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.infection_terms));
  __pyx_v___pyx_result->__pyx_base.infection_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.linear_terms);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.linear_terms));
  __pyx_v___pyx_result->__pyx_base.linear_terms = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.lyapunov_method);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.lyapunov_method);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.lyapunov_method = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.model_param_keys);
  __pyx_v___pyx_result->__pyx_base.model_param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_parameters);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.model_parameters));
  __pyx_v___pyx_result->__pyx_base.model_parameters = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_parameters_length);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.model_parameters_length));
  __pyx_v___pyx_result->__pyx_base.model_parameters_length = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.model_spec);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.model_spec);
  __pyx_v___pyx_result->__pyx_base.model_spec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.nClass = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.param_dict);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.param_dict);
  __pyx_v___pyx_result->__pyx_base.param_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.param_keys);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.param_keys);
  __pyx_v___pyx_result->__pyx_base.__pyx_base.param_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.param_mapping_enabled = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.parameter_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.parameter_mapping);
  __pyx_v___pyx_result->__pyx_base.parameter_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 41, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.resource_list);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.resource_list));
  __pyx_v___pyx_result->__pyx_base.resource_list = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 42, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.rows);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.rows));
  __pyx_v___pyx_result->__pyx_base.__pyx_base.rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 43, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.rtol_det = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 44, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.rtol_lyapunov = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 45, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.steps = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 46, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.time_dep_param_mapping);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.time_dep_param_mapping);
  __pyx_v___pyx_result->__pyx_base.time_dep_param_mapping = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 47, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.__pyx_base.vec_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[48])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_2 > 48) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[48])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 48, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[48])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_SppSparse__set_state(<SppSparse> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppSparse__set_state(SppSparse __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.infection_terms = __pyx_state[29]; __pyx_result.linear_terms = __pyx_state[30]; __pyx_result.lyapunov_method = __pyx_state[31]; __pyx_result.model_param_keys = __pyx_state[32]; __pyx_result.model_parameters = __pyx_state[33]; __pyx_result.model_parameters_length = __pyx_state[34]; __pyx_result.model_spec = __pyx_state[35]; __pyx_result.nClass = __pyx_state[36]; __pyx_result.param_dict = __pyx_state[37]; __pyx_result.param_keys = __pyx_state[38]; __pyx_result.param_mapping_enabled = __pyx_state[39]; __pyx_result.parameter_mapping = __pyx_state[40]; __pyx_result.resource_list = __pyx_state[41]; __pyx_result.rows = __pyx_state[42]; __pyx_result.rtol_det = __pyx_state[43]; __pyx_result.rtol_lyapunov = __pyx_state[44]; __pyx_result.steps = __pyx_state[45]; __pyx_result.time_dep_param_mapping = __pyx_state[46]; __pyx_result.vec_size = __pyx_state[47]
 *     if len(__pyx_state) > 48 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyross.inference.__pyx_unpickle_SppSparse__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyArray_Descr *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
 * 
 *             cdef int i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
 *             cdef int i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  if (unlikely(__pyx_t_1)) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 272, __pyx_L1_error)

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  if (unlikely(__pyx_t_1)) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 276, __pyx_L1_error)

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_4 = __pyx_v_ndim;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
    goto __pyx_L9;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
  /*else*/ {
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L9:;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = <dtype>PyArray_DESCR(self)
 *             cdef int offset
 */
  __pyx_v_f = NULL;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
 *             cdef int offset
 * 
 */
  __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
  __pyx_t_3 = ((PyObject *)__pyx_t_7);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":300
 *             cdef int offset
 * 
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not PyDataType_HASFIELDS(descr):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
 *             info.obj = self
 * 
 *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
  if (__pyx_t_1) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":303
 * 
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_t_4 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_4;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
    if (!__pyx_t_2) {
      goto __pyx_L15_next_or;
    } else {
    }
    __pyx_t_2 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_L15_next_or:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":305
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    if (unlikely(__pyx_t_1)) {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 306, __pyx_L1_error)

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":307
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    switch (__pyx_v_t) {
      case NPY_BYTE:
      __pyx_v_f = ((char *)"b");
      break;
      case NPY_UBYTE:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":308
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      __pyx_v_f = ((char *)"B");
      break;
      case NPY_SHORT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":309
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      __pyx_v_f = ((char *)"h");
      break;
      case NPY_USHORT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":310
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      __pyx_v_f = ((char *)"H");
      break;
      case NPY_INT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":311
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      __pyx_v_f = ((char *)"i");
      break;
      case NPY_UINT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":312
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      __pyx_v_f = ((char *)"I");
      break;
      case NPY_LONG:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":313
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      __pyx_v_f = ((char *)"l");
      break;
      case NPY_ULONG:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":314
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      __pyx_v_f = ((char *)"L");
      break;
      case NPY_LONGLONG:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":315
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      __pyx_v_f = ((char *)"q");
      break;
      case NPY_ULONGLONG:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":316
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      __pyx_v_f = ((char *)"Q");
      break;
      case NPY_FLOAT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":317
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      __pyx_v_f = ((char *)"f");
      break;
      case NPY_DOUBLE:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":318
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      __pyx_v_f = ((char *)"d");
      break;
      case NPY_LONGDOUBLE:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":319
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      __pyx_v_f = ((char *)"g");
      break;
      case NPY_CFLOAT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":320
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      __pyx_v_f = ((char *)"Zf");
      break;
      case NPY_CDOUBLE:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":321
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      __pyx_v_f = ((char *)"Zd");
      break;
      case NPY_CLONGDOUBLE:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":322
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      __pyx_v_f = ((char *)"Zg");
      break;
      case NPY_OBJECT:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":323
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_v_f = ((char *)"O");
      break;
      default:

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":325
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 325, __pyx_L1_error)
      break;
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":326
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":327
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
 *             info.obj = self
 * 
 *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":329
 *                 return
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
  /*else*/ {
    __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":330
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":331
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":332
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 */
    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 332, __pyx_L1_error)
    __pyx_v_f = __pyx_t_9;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":335
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":339
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)
 */
    PyObject_Free(__pyx_v_info->format);

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":341
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    PyObject_Free(__pyx_v_info->strides);

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __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(2, 828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __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(2, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 */
  __Pyx_XDECREF(__pyx_r);
  __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(2, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
 * 
 *     cdef dtype child
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
 *     cdef dtype child
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(__pyx_v_descr->names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(2, 851, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 851, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    if (unlikely(__pyx_v_descr->fields == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 852, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 852, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 */
    if (likely(__pyx_v_fields != Py_None)) {
      PyObject* sequence = __pyx_v_fields;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(2, 853, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 855, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
    if (unlikely(__pyx_t_6)) {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 856, __pyx_L1_error)

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
    if (!__pyx_t_7) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_7 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":859
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    if (unlikely(__pyx_t_6)) {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 860, __pyx_L1_error)

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":870
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 870, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":871
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 0x78;

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":872
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":873
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_8 = 0;
      (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":875
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_8 = 0;
    (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_6) {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":878
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (unlikely(__pyx_t_6)) {

        /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(2, 880, __pyx_L1_error)

        /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":883
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 883, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":884
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 884, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":885
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 885, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x68;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":886
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 886, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":887
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 887, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x69;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":888
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 888, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":889
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 889, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x6C;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":890
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 890, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":891
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 891, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x71;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":892
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 892, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":893
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 893, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x66;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":894
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 894, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x64;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":895
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 895, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x67;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":896
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 896, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x66;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":897
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 897, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x64;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":898
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 898, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x67;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":899
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 899, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (likely(__pyx_t_6)) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":901
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
      /*else*/ {
        __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(2, 901, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":902
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
      goto __pyx_L13;
    }

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":906
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
    /*else*/ {
      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 906, __pyx_L1_error)
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":907
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023
 * 
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
 */
  Py_INCREF(__pyx_v_base);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_v_base;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
 *     if base is NULL:
 *         return None
 */
  __pyx_v_base = PyArray_BASE(__pyx_v_arr);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1029
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return <object>base
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030
 *     if base is NULL:
 *         return None
 *     return <object>base             # <<<<<<<<<<<<<<
 * 
 * # Versions of the import_* functions which are more suitable for
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_base));
  __pyx_r = ((PyObject *)__pyx_v_base);
  goto __pyx_L0;

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036
 * cdef inline int import_array() except -1:
 *     try:
 *         _import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")
 */
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037
 *     try:
 *         _import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 1038, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 1044, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 1050, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":122
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    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};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s_c);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
    } else {

      /* "View.MemoryView":123
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
 */
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
  }
  __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);

  /* "View.MemoryView":122
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_dim;
  PyObject **__pyx_v_p;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  char *__pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":129
 *         cdef PyObject **p
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
 */
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 129, __pyx_L1_error)
  }
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":130
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
 */
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":132
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":133
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 133, __pyx_L1_error)

    /* "View.MemoryView":132
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  }

  /* "View.MemoryView":135
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":136
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 136, __pyx_L1_error)

    /* "View.MemoryView":135
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  }

  /* "View.MemoryView":138
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":139
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":138
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  }

  /* "View.MemoryView":140
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
 */
  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(1, 140, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":141
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_self->_format == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(1, 141, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_7;

  /* "View.MemoryView":144
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
 */
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":145
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
 */
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":147
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "View.MemoryView":148
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 148, __pyx_L1_error)

    /* "View.MemoryView":147
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  }

  /* "View.MemoryView":151
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  __pyx_t_8 = 0;
  __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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(1, 151, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_9;
    __pyx_v_idx = __pyx_t_8;
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":152
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":153
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
 */
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __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(1, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(1, 153, __pyx_L1_error)

      /* "View.MemoryView":152
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    }

    /* "View.MemoryView":154
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
 */
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":151
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":157
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":158
 *         cdef char order
 *         if mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 */
    __pyx_v_order = 'F';

    /* "View.MemoryView":159
 *         if mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         elif mode == 'c':
 *             order = b'C'
 */
    __Pyx_INCREF(__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_fortran;

    /* "View.MemoryView":157
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":160
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
  if (likely(__pyx_t_4)) {

    /* "View.MemoryView":161
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         else:
 */
    __pyx_v_order = 'C';

    /* "View.MemoryView":162
 *         elif mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 */
    __Pyx_INCREF(__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_c;

    /* "View.MemoryView":160
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":164
 *             self.mode = u'c'
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,
 */
  /*else*/ {
    __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(1, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(1, 164, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "View.MemoryView":166
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
 *                                              itemsize, self.ndim, order)
 * 
 */
  __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);

  /* "View.MemoryView":169
 *                                              itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:
 */
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":170
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 *         if allocate_buffer:
 * 
 */
  __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(1, 170, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_4;

  /* "View.MemoryView":171
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":174
 * 
 * 
 *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")
 */
    __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

    /* "View.MemoryView":175
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":176
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(1, 176, __pyx_L1_error)

      /* "View.MemoryView":175
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    }

    /* "View.MemoryView":178
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":179
 * 
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 */
      __pyx_v_p = ((PyObject **)__pyx_v_self->data);

      /* "View.MemoryView":180
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)
 */
      if (unlikely(__pyx_v_itemsize == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(1, 180, __pyx_L1_error)
      }
      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))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(1, 180, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
      __pyx_t_9 = __pyx_t_1;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

        /* "View.MemoryView":181
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None             # <<<<<<<<<<<<<<
 *                     Py_INCREF(Py_None)
 * 
 */
        (__pyx_v_p[__pyx_v_i]) = Py_None;

        /* "View.MemoryView":182
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
        Py_INCREF(Py_None);
      }

      /* "View.MemoryView":178
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    }

    /* "View.MemoryView":171
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":122
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":185
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":186
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":187
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":188
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
    __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":187
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":189
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":190
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 */
    __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":189
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":191
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":192
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 192, __pyx_L1_error)

    /* "View.MemoryView":191
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  }

  /* "View.MemoryView":193
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 *         info.ndim = self.ndim
 */
  __pyx_t_4 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":194
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 */
  __pyx_t_5 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_5;

  /* "View.MemoryView":195
 *         info.buf = self.data
 *         info.len = self.len
 *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *         info.shape = self._shape
 *         info.strides = self._strides
 */
  __pyx_t_6 = __pyx_v_self->ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":196
 *         info.len = self.len
 *         info.ndim = self.ndim
 *         info.shape = self._shape             # <<<<<<<<<<<<<<
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 */
  __pyx_t_7 = __pyx_v_self->_shape;
  __pyx_v_info->shape = __pyx_t_7;

  /* "View.MemoryView":197
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 *         info.strides = self._strides             # <<<<<<<<<<<<<<
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 */
  __pyx_t_7 = __pyx_v_self->_strides;
  __pyx_v_info->strides = __pyx_t_7;

  /* "View.MemoryView":198
 *         info.shape = self._shape
 *         info.strides = self._strides
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 */
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":199
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 * 
 */
  __pyx_t_5 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_5;

  /* "View.MemoryView":200
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":202
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":203
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_4 = __pyx_v_self->format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":202
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":205
 *             info.format = self.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.obj = self
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":207
 *             info.format = NULL
 * 
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":185
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":211
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":212
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":213
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data:
 *             if self.dtype_is_object:
 */
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":212
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":214
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  __pyx_t_1 = (__pyx_v_self->free_data != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":215
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":216
 *         elif self.free_data:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":215
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    }

    /* "View.MemoryView":218
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
 */
    free(__pyx_v_self->data);

    /* "View.MemoryView":214
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":219
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":211
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":222
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":223
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":222
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":226
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":227
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 */
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":228
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":226
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":230
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":231
 * 
 *     def __len__(self):
 *         return self._shape[0]             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, attr):
 */
  __pyx_r = (__pyx_v_self->_shape[0]);
  goto __pyx_L0;

  /* "View.MemoryView":230
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":233
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":234
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":233
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":236
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":237
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":236
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":239
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":240
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":239
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":244
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

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) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":248
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":249
 * 
 *     if buf == NULL:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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(1, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":248
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":251
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
  /*else*/ {
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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(1, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;

    /* "View.MemoryView":252
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)

    /* "View.MemoryView":251
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "View.MemoryView":253
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":255
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":244
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":281
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":282
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":281
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":283
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":284
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":283
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.name,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.name is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->name != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":298
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  Py_intptr_t __pyx_v_aligned_p;
  size_t __pyx_v_offset;
  void *__pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":300
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
 *     cdef size_t offset
 * 
 */
  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);

  /* "View.MemoryView":304
 * 
 *     with cython.cdivision(True):
 *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
 * 
 *     if offset > 0:
 */
  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);

  /* "View.MemoryView":306
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":307
 * 
 *     if offset > 0:
 *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
 * 
 *     return <void *> aligned_p
 */
    __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));

    /* "View.MemoryView":306
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  }

  /* "View.MemoryView":309
 *         aligned_p += alignment - offset
 * 
 *     return <void *> aligned_p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((void *)__pyx_v_aligned_p);
  goto __pyx_L0;

  /* "View.MemoryView":298
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":345
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":346
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 */
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":347
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 */
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":348
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_obj != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":349
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 */
    __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)

    /* "View.MemoryView":350
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":351
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
 */
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":352
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         global __pyx_memoryview_thread_locks_used
 */
      Py_INCREF(Py_None);

      /* "View.MemoryView":350
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    }

    /* "View.MemoryView":348
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  }

  /* "View.MemoryView":355
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":356
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 */
    __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

    /* "View.MemoryView":357
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 */
    __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

    /* "View.MemoryView":355
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  }

  /* "View.MemoryView":358
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":359
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 raise MemoryError
 */
    __pyx_v_self->lock = PyThread_allocate_lock();

    /* "View.MemoryView":360
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "View.MemoryView":361
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
      PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)

      /* "View.MemoryView":360
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    }

    /* "View.MemoryView":358
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  }

  /* "View.MemoryView":363
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":364
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
 */
    __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":363
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":366
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 */
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L10:;

  /* "View.MemoryView":368
 *             self.dtype_is_object = dtype_is_object
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL
 */
  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));

  /* "View.MemoryView":370
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
 */
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":345
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":372
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyThread_type_lock __pyx_t_6;
  PyThread_type_lock __pyx_t_7;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":373
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":374
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
 */
    __Pyx_ReleaseBuffer((&__pyx_v_self->view));

    /* "View.MemoryView":373
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 * 
 */
  }

  /* "View.MemoryView":378
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":379
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 */
    __pyx_t_3 = __pyx_memoryview_thread_locks_used;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":380
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":381
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 */
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":382
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":384
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":383
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
 */
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;

          /* "View.MemoryView":382
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        }

        /* "View.MemoryView":385
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
 */
        goto __pyx_L6_break;

        /* "View.MemoryView":380
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      }
    }
    /*else*/ {

      /* "View.MemoryView":387
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 */
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":378
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  }

  /* "View.MemoryView":372
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":389
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":391
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
 */
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":393
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 393, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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(1, 393, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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(1, 393, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 393, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":394
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
 */
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 394, __pyx_L1_error)
    __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(1, 394, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":393
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":396
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":389
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":399
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":400
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":401
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "View.MemoryView":400
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  }

  /* "View.MemoryView":403
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
 */
  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 403, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 403, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_indices = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "View.MemoryView":406
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 406, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "View.MemoryView":407
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":406
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  }

  /* "View.MemoryView":409
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
 */
  /*else*/ {
    __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(1, 409, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_6;

    /* "View.MemoryView":410
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
 */
    __Pyx_XDECREF(__pyx_r);
    __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(1, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":399
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":412
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")
 */

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":413
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot assign to read-only memoryview")
 * 
 */
  __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":414
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 414, __pyx_L1_error)

    /* "View.MemoryView":413
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot assign to read-only memoryview")
 * 
 */
  }

  /* "View.MemoryView":416
 *             raise TypeError("Cannot assign to read-only memoryview")
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
 */
  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 416, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 416, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":418
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 418, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "View.MemoryView":419
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)
 */
    __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(1, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_obj = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "View.MemoryView":420
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 420, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":421
 *             obj = self.is_slice(value)
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __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(1, 421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":420
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":423
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 423, __pyx_L1_error)
      __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(1, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L5:;

    /* "View.MemoryView":418
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":425
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
 */
  /*else*/ {
    __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(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "View.MemoryView":412
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":427
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":428
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":429
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "View.MemoryView":430
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 430, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":431
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
 */
        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 431, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "View.MemoryView":430
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 430, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_obj);
        __Pyx_GIVEREF(__pyx_v_obj);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 430, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "View.MemoryView":429
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "View.MemoryView":432
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 432, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":433
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;

      /* "View.MemoryView":429
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "View.MemoryView":428
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 */
  }

  /* "View.MemoryView":435
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":427
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":437
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":441
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 441, __pyx_L1_error)

  /* "View.MemoryView":442
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 */
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 442, __pyx_L1_error)

  /* "View.MemoryView":443
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":441
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 441, __pyx_L1_error)

  /* "View.MemoryView":437
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":445
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

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) {
  int __pyx_v_array[0x80];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":447
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
 */
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":452
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 */
  __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));

  /* "View.MemoryView":454
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":455
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
 */
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":456
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "View.MemoryView":457
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
 */
      PyErr_NoMemory(); __PYX_ERR(1, 457, __pyx_L1_error)

      /* "View.MemoryView":456
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    }

    /* "View.MemoryView":458
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
 */
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":454
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":460
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":462
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
 */
  /*try:*/ {

    /* "View.MemoryView":463
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":464
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
 */
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":463
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
      goto __pyx_L8;
    }

    /* "View.MemoryView":466
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __pyx_t_2 = ((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_2)) __PYX_ERR(1, 466, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":470
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":471
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
 */
      __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 471, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "View.MemoryView":470
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    }

    /* "View.MemoryView":472
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
 */
    __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);
  }

  /* "View.MemoryView":475
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
 */
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":445
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":477
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":478
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
 */
  __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(1, 478, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":479
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __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(1, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":477
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":481
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":484
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":487
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":488
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":489
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 489, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 489, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __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(1, 489, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __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(1, 489, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 489, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_bytesitem);
        __Pyx_GIVEREF(__pyx_v_bytesitem);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 489, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":488
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    }

    /* "View.MemoryView":493
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
    /*else:*/ {
      __pyx_t_10 = strlen(__pyx_v_self->view.format); 
      __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
      if (__pyx_t_11) {

        /* "View.MemoryView":494
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":493
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
      }

      /* "View.MemoryView":495
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "View.MemoryView":490
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError("Unable to convert item to object")
 *         else:
 */
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 490, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
    __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 490, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_1);

      /* "View.MemoryView":491
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 491, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(1, 491, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "View.MemoryView":488
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":481
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":497
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  char *__pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":500
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":505
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "View.MemoryView":506
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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(1, 506, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":505
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":508
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __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(1, 508, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __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(1, 508, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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(1, 508, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":510
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
  __pyx_t_9 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(1, 510, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_10 = __pyx_v_bytesvalue;
  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_11 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_11[0]);

    /* "View.MemoryView":511
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    __pyx_v_i = __pyx_t_9;

    /* "View.MemoryView":510
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "View.MemoryView":511
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "View.MemoryView":497
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":514
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  char *__pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":515
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 */
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":516
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__67, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 516, __pyx_L1_error)

    /* "View.MemoryView":515
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 */
  }

  /* "View.MemoryView":518
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":519
 * 
 *         if flags & PyBUF_ND:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_4;

    /* "View.MemoryView":518
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
    goto __pyx_L6;
  }

  /* "View.MemoryView":521
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
 */
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":523
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":524
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_4;

    /* "View.MemoryView":523
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
    goto __pyx_L7;
  }

  /* "View.MemoryView":526
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
 */
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L7:;

  /* "View.MemoryView":528
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":529
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_4;

    /* "View.MemoryView":528
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
    goto __pyx_L8;
  }

  /* "View.MemoryView":531
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L8:;

  /* "View.MemoryView":533
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":534
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_5 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_5;

    /* "View.MemoryView":533
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":536
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L9:;

  /* "View.MemoryView":538
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 */
  __pyx_t_6 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_6;

  /* "View.MemoryView":539
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 */
  __pyx_t_7 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_7;

  /* "View.MemoryView":540
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 */
  __pyx_t_8 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_8;

  /* "View.MemoryView":541
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = self.view.readonly
 *         info.obj = self
 */
  __pyx_t_8 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_8;

  /* "View.MemoryView":542
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
 */
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_v_info->readonly = __pyx_t_1;

  /* "View.MemoryView":543
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":514
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":549
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":550
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
 */
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 550, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":551
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 551, __pyx_L1_error)

  /* "View.MemoryView":552
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":549
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":555
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":556
 *     @property
 *     def base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

  /* "View.MemoryView":555
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":559
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":560
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_length = (__pyx_t_2[0]);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 560, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":559
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":563
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":564
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":566
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 566, __pyx_L1_error)

    /* "View.MemoryView":564
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  }

  /* "View.MemoryView":568
 *             raise ValueError("Buffer view does not expose strides")
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_stride = (__pyx_t_3[0]);
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 568, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":563
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":571
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":572
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":573
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__69, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":572
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  }

  /* "View.MemoryView":575
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
    __pyx_t_4 = __pyx_t_6;
    __pyx_v_suboffset = (__pyx_t_4[0]);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 575, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":571
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":578
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":579
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":578
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":582
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":583
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":582
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":586
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":587
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":586
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":590
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":591
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":592
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 */
    __Pyx_INCREF(__pyx_int_1);
    __pyx_v_result = __pyx_int_1;

    /* "View.MemoryView":594
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
 */
    __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 594, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "View.MemoryView":595
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
 */
      __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
      __pyx_t_6 = 0;
    }

    /* "View.MemoryView":597
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
 */
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":591
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  }

  /* "View.MemoryView":599
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":590
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":601
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":602
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":603
 *     def __len__(self):
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_r = (__pyx_v_self->view.shape[0]);
    goto __pyx_L0;

    /* "View.MemoryView":602
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  }

  /* "View.MemoryView":605
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":601
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":607
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":608
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":609
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "View.MemoryView":608
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __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(1, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":607
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":611
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":612
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":611
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":615
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":618
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 */
  __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));

  /* "View.MemoryView":619
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":615
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":621
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":624
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 */
  __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));

  /* "View.MemoryView":625
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":621
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":627
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":629
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":631
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":632
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
 */
  __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(1, 632, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":637
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":627
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":639
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":641
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":643
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":644
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
 */
  __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(1, 644, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":649
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":639
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":653
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":654
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_o);
  __Pyx_GIVEREF(__pyx_v_o);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":655
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":656
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":653
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":659
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memoryview_check", 0);

  /* "View.MemoryView":660
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":659
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":662
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":667
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":668
 *     """
 *     if not isinstance(index, tuple):
 *         tup = (index,)             # <<<<<<<<<<<<<<
 *     else:
 *         tup = index
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
    __pyx_v_tup = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "View.MemoryView":667
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":670
 *         tup = (index,)
 *     else:
 *         tup = index             # <<<<<<<<<<<<<<
 * 
 *     result = []
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_tup = __pyx_v_index;
  }
  __pyx_L3:;

  /* "View.MemoryView":672
 *         tup = index
 * 
 *     result = []             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":673
 * 
 *     result = []
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 */
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":674
 *     result = []
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 */
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":675
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_3 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
    __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 675, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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(1, 675, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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(1, 675, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 675, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "View.MemoryView":676
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":677
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
      if (__pyx_t_1) {

        /* "View.MemoryView":678
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
        __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 678, __pyx_L1_error)
        __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(1, 678, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        { Py_ssize_t __pyx_temp;
          for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
            __Pyx_INCREF(__pyx_slice_);
            __Pyx_GIVEREF(__pyx_slice_);
            PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice_);
          }
        }
        __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 678, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "View.MemoryView":679
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             else:
 *                 result.append(slice(None))
 */
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":677
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":681
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice_); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 681, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":682
 *             else:
 *                 result.append(slice(None))
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 */
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":676
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":684
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
      __pyx_t_1 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (unlikely(__pyx_t_1)) {

        /* "View.MemoryView":685
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 */
        __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(1, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(1, 685, __pyx_L1_error)

        /* "View.MemoryView":684
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
      }

      /* "View.MemoryView":687
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
 *             result.append(item)
 * 
 */
      __pyx_t_10 = (__pyx_v_have_slices != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = PySlice_Check(__pyx_v_item); 
      __pyx_t_2 = (__pyx_t_10 != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L11_bool_binop_done:;
      __pyx_v_have_slices = __pyx_t_1;

      /* "View.MemoryView":688
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 *             result.append(item)             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - len(result)
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 688, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "View.MemoryView":675
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":690
 *             result.append(item)
 * 
 *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
 *     if nslices:
 *         result.extend([slice(None)] * nslices)
 */
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 690, __pyx_L1_error)
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);

  /* "View.MemoryView":691
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  __pyx_t_1 = (__pyx_v_nslices != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":692
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
    __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
        __Pyx_INCREF(__pyx_slice_);
        __Pyx_GIVEREF(__pyx_slice_);
        PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice_);
      }
    }
    __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "View.MemoryView":691
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  }

  /* "View.MemoryView":694
 *         result.extend([slice(None)] * nslices)
 * 
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L14_bool_binop_done:;
  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":662
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":696
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);

  /* "View.MemoryView":697
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")
 */
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":698
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":699
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(1, 699, __pyx_L1_error)

      /* "View.MemoryView":698
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    }
  }

  /* "View.MemoryView":696
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":706
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_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;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":707
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
 */
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":714
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
 */
  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));

  /* "View.MemoryView":718
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(1, 718, __pyx_L1_error)
    }
  }
  #endif

  /* "View.MemoryView":720
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":721
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 721, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":722
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
 */
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

    /* "View.MemoryView":720
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":724
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":725
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":731
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
 */
  __pyx_t_4 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_4;

  /* "View.MemoryView":732
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_5;

  /* "View.MemoryView":737
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step
 */
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":738
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step
 *     cdef bint have_start, have_stop, have_step
 */
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":742
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 742, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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(1, 742, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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(1, 742, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 742, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      }
    } else {
      __pyx_t_9 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 742, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_v_dim = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "View.MemoryView":743
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
    __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":747
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 */
      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 747, __pyx_L1_error)

      /* "View.MemoryView":744
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __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(1, 744, __pyx_L1_error)

      /* "View.MemoryView":743
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":750
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
    __pyx_t_2 = (__pyx_v_index == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":751
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 */
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":752
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
 */
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":753
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
 */
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":754
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":750
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":756
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 756, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 756, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_10;

      /* "View.MemoryView":757
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 757, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 757, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_10;

      /* "View.MemoryView":758
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 758, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 758, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_10;

      /* "View.MemoryView":760
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":761
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":762
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":764
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __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(1, 764, __pyx_L1_error)

      /* "View.MemoryView":770
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":742
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":772
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":773
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":774
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 774, __pyx_L1_error) }

    /* "View.MemoryView":775
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 775, __pyx_L1_error) }

    /* "View.MemoryView":773
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __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(1, 773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 773, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":772
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  }

  /* "View.MemoryView":778
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":779
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __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(1, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "View.MemoryView":778
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 778, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":706
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":803
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

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) {
  Py_ssize_t __pyx_v_new_shape;
  int __pyx_v_negative_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":823
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":825
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":826
 * 
 *         if start < 0:
 *             start += shape             # <<<<<<<<<<<<<<
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 */
      __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

      /* "View.MemoryView":825
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    }

    /* "View.MemoryView":827
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    __pyx_t_1 = (0 <= __pyx_v_start);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
    }
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":828
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
 */
      __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(1, 828, __pyx_L1_error)

      /* "View.MemoryView":827
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    }

    /* "View.MemoryView":823
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":831
 *     else:
 * 
 *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
 * 
 *         if have_step and step == 0:
 */
  /*else*/ {
    __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step < 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L6_bool_binop_done:;
    __pyx_v_negative_step = __pyx_t_2;

    /* "View.MemoryView":833
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    __pyx_t_1 = (__pyx_v_have_step != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step == 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_2) {

      /* "View.MemoryView":834
 * 
 *         if have_step and step == 0:
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __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(1, 834, __pyx_L1_error)

      /* "View.MemoryView":833
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    }

    /* "View.MemoryView":837
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
    __pyx_t_2 = (__pyx_v_have_start != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":838
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":839
 *         if have_start:
 *             if start < 0:
 *                 start += shape             # <<<<<<<<<<<<<<
 *                 if start < 0:
 *                     start = 0
 */
        __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

        /* "View.MemoryView":840
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":841
 *                 start += shape
 *                 if start < 0:
 *                     start = 0             # <<<<<<<<<<<<<<
 *             elif start >= shape:
 *                 if negative_step:
 */
          __pyx_v_start = 0;

          /* "View.MemoryView":840
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        }

        /* "View.MemoryView":838
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
        goto __pyx_L12;
      }

      /* "View.MemoryView":842
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":843
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
        __pyx_t_2 = (__pyx_v_negative_step != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":844
 *             elif start >= shape:
 *                 if negative_step:
 *                     start = shape - 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     start = shape
 */
          __pyx_v_start = (__pyx_v_shape - 1);

          /* "View.MemoryView":843
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
          goto __pyx_L14;
        }

        /* "View.MemoryView":846
 *                     start = shape - 1
 *                 else:
 *                     start = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        /*else*/ {
          __pyx_v_start = __pyx_v_shape;
        }
        __pyx_L14:;

        /* "View.MemoryView":842
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      }
      __pyx_L12:;

      /* "View.MemoryView":837
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
      goto __pyx_L11;
    }

    /* "View.MemoryView":848
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":849
 *         else:
 *             if negative_step:
 *                 start = shape - 1             # <<<<<<<<<<<<<<
 *             else:
 *                 start = 0
 */
        __pyx_v_start = (__pyx_v_shape - 1);

        /* "View.MemoryView":848
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
        goto __pyx_L15;
      }

      /* "View.MemoryView":851
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
 */
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L15:;
    }
    __pyx_L11:;

    /* "View.MemoryView":853
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
    __pyx_t_2 = (__pyx_v_have_stop != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":854
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":855
 *         if have_stop:
 *             if stop < 0:
 *                 stop += shape             # <<<<<<<<<<<<<<
 *                 if stop < 0:
 *                     stop = 0
 */
        __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);

        /* "View.MemoryView":856
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":857
 *                 stop += shape
 *                 if stop < 0:
 *                     stop = 0             # <<<<<<<<<<<<<<
 *             elif stop > shape:
 *                 stop = shape
 */
          __pyx_v_stop = 0;

          /* "View.MemoryView":856
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        }

        /* "View.MemoryView":854
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
        goto __pyx_L17;
      }

      /* "View.MemoryView":858
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":859
 *                     stop = 0
 *             elif stop > shape:
 *                 stop = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        __pyx_v_stop = __pyx_v_shape;

        /* "View.MemoryView":858
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      }
      __pyx_L17:;

      /* "View.MemoryView":853
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
      goto __pyx_L16;
    }

    /* "View.MemoryView":861
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":862
 *         else:
 *             if negative_step:
 *                 stop = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 stop = shape
 */
        __pyx_v_stop = -1L;

        /* "View.MemoryView":861
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
        goto __pyx_L19;
      }

      /* "View.MemoryView":864
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 *         if not have_step:
 */
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L19:;
    }
    __pyx_L16:;

    /* "View.MemoryView":866
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":867
 * 
 *         if not have_step:
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_step = 1;

      /* "View.MemoryView":866
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    }

    /* "View.MemoryView":871
 * 
 *         with cython.cdivision(True):
 *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
 * 
 *             if (stop - start) - step * new_shape:
 */
    __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);

    /* "View.MemoryView":873
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":874
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
 */
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

      /* "View.MemoryView":873
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    }

    /* "View.MemoryView":876
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":877
 * 
 *         if new_shape < 0:
 *             new_shape = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_new_shape = 0;

      /* "View.MemoryView":876
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    }

    /* "View.MemoryView":880
 * 
 * 
 *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset
 */
    (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);

    /* "View.MemoryView":881
 * 
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
 *         dst.suboffsets[new_ndim] = suboffset
 * 
 */
    (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;

    /* "View.MemoryView":882
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  }
  __pyx_L3:;

  /* "View.MemoryView":885
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":886
 * 
 *     if suboffset_dim[0] < 0:
 *         dst.data += start * stride             # <<<<<<<<<<<<<<
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 */
    __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));

    /* "View.MemoryView":885
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
    goto __pyx_L23;
  }

  /* "View.MemoryView":888
 *         dst.data += start * stride
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
 * 
 *     if suboffset >= 0:
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
    (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  }
  __pyx_L23:;

  /* "View.MemoryView":890
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":891
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":892
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":893
 *         if not is_slice:
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 */
        __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);

        /* "View.MemoryView":892
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
        goto __pyx_L26;
      }

      /* "View.MemoryView":895
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
 */
      /*else*/ {

        /* "View.MemoryView":896
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             suboffset_dim[0] = new_ndim
 */
        __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(1, 895, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "View.MemoryView":891
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
      goto __pyx_L25;
    }

    /* "View.MemoryView":898
 *                                      "must be indexed and not sliced", dim)
 *         else:
 *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    /*else*/ {
      (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
    }
    __pyx_L25:;

    /* "View.MemoryView":890
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  }

  /* "View.MemoryView":900
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":803
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":906
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

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) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":908
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
 */
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":909
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
 */
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":912
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":913
 * 
 *     if view.ndim == 0:
 *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
 */
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 913, __pyx_L1_error)
    }
    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))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 913, __pyx_L1_error)
    }
    __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);

    /* "View.MemoryView":914
 *     if view.ndim == 0:
 *         shape = view.len / itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
 */
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":912
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":916
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 */
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":917
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
 */
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":918
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":919
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
 */
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":918
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":921
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":922
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 */
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":923
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":924
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __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(1, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 924, __pyx_L1_error)

      /* "View.MemoryView":923
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    }

    /* "View.MemoryView":921
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  }

  /* "View.MemoryView":926
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":927
 * 
 *     if index >= shape:
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
 */
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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(1, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 927, __pyx_L1_error)

    /* "View.MemoryView":926
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  }

  /* "View.MemoryView":929
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
 */
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":930
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":931
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
 */
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":930
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  }

  /* "View.MemoryView":933
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":906
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":939
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;

  /* "View.MemoryView":940
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 */
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":942
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":943
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":947
 * 
 *     cdef int i, j
 *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 */
  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":948
 *     cdef int i, j
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
 */
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":949
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 */
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;

    /* "View.MemoryView":950
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 */
    __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":952
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "View.MemoryView":953
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 1
 */
      __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(1, 953, __pyx_L1_error)

      /* "View.MemoryView":952
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    }
  }

  /* "View.MemoryView":955
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "View.MemoryView":939
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":972
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":973
 * 
 *     def __dealloc__(self):
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":972
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":975
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":976
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":977
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":976
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  }

  /* "View.MemoryView":979
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __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(1, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":975
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":981
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":982
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":983
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
 */
    __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 983, __pyx_L1_error)

    /* "View.MemoryView":982
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":985
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __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(1, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":981
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":988
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":989
 *     @property
 *     def base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":988
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":995
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

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) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":1003
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1004
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "View.MemoryView":1003
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "View.MemoryView":1009
 * 
 * 
 *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":1011
 *     result = _memoryviewslice(None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 */
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":1012
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 */
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1014
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":1015
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
 */
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":1017
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 */
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":1018
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 */
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":1019
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
 */
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":1020
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
 */
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":1021
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 */
  Py_INCREF(Py_None);

  /* "View.MemoryView":1023
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
 */
  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1024
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 *     else:
 *         result.flags = PyBUF_RECORDS_RO
 */
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

    /* "View.MemoryView":1023
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":1026
 *         result.flags = PyBUF_RECORDS
 *     else:
 *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 */
  /*else*/ {
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  }
  __pyx_L4:;

  /* "View.MemoryView":1028
 *         result.flags = PyBUF_RECORDS_RO
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
 */
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":1029
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":1032
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 */
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":1033
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 */
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":1034
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":1035
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":1036
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
 */
      goto __pyx_L6_break;

      /* "View.MemoryView":1034
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    }
  }
  __pyx_L6_break:;

  /* "View.MemoryView":1038
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
 */
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":1039
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
 */
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1040
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1040, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1042
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
 */
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":1043
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":1045
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":995
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1048
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 */

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1051
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1052
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1052, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":1053
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
 */
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":1051
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  }

  /* "View.MemoryView":1055
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1056
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
 */
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1048
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1059
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  __Pyx_RefNannySetupContext("slice_copy", 0);

  /* "View.MemoryView":1063
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
 */
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":1064
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
 */
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":1065
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 */
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":1067
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
 */
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":1068
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
 */
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":1070
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 */
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_dim = __pyx_t_4;

    /* "View.MemoryView":1071
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 */
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":1072
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 */
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":1073
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
 */
    if ((__pyx_v_suboffsets != 0)) {
      __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_5 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  }

  /* "View.MemoryView":1059
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1076
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1079
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 */
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":1080
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1076
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1083
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *(*__pyx_t_3)(char *);
  int (*__pyx_t_4)(char *, PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1090
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1091
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 */
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_3;

    /* "View.MemoryView":1092
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
 */
    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_4;

    /* "View.MemoryView":1090
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1094
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
 */
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1095
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 */
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1097
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1099
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __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(1, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1083
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1105
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":1106
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1107
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:
 *         return -arg             # <<<<<<<<<<<<<<
 *     else:
 *         return arg
 */
    __pyx_r = (-__pyx_v_arg);
    goto __pyx_L0;

    /* "View.MemoryView":1106
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  }

  /* "View.MemoryView":1109
 *         return -arg
 *     else:
 *         return arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
 */
  /*else*/ {
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1105
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1112
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1117
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
 */
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1118
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1120
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1121
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1122
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1123
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
      goto __pyx_L4_break;

      /* "View.MemoryView":1121
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1125
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 */
  __pyx_t_1 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_1;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1126
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1127
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1128
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 */
      goto __pyx_L7_break;

      /* "View.MemoryView":1126
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1130
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1131
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
 */
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1130
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  }

  /* "View.MemoryView":1133
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1112
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1136
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

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) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;

  /* "View.MemoryView":1143
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 */
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1144
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 */
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1145
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 */
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1146
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1148
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1149
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1150
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 */
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_3 = (__pyx_t_2 != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1149
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    if (__pyx_t_1) {

      /* "View.MemoryView":1151
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *        else:
 *            for i in range(dst_extent):
 */
      (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));

      /* "View.MemoryView":1149
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":1153
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_dst_extent;
      __pyx_t_5 = __pyx_t_4;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "View.MemoryView":1154
 *        else:
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                src_data += src_stride
 *                dst_data += dst_stride
 */
        (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));

        /* "View.MemoryView":1155
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride             # <<<<<<<<<<<<<<
 *                dst_data += dst_stride
 *     else:
 */
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1156
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 *                dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
 */
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1148
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1158
 *                dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_dst_extent;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "View.MemoryView":1159
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
 */
      _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);

      /* "View.MemoryView":1163
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
 */
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1164
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
 */
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1136
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

  /* function exit code */
}

/* "View.MemoryView":1166
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

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) {

  /* "View.MemoryView":1169
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 */
  _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);

  /* "View.MemoryView":1166
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1173
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 */

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1176
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1178
 *     cdef Py_ssize_t size = src.memview.view.itemsize
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         size *= src.shape[i]
 * 
 */
  __pyx_t_2 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1179
 * 
 *     for i in range(ndim):
 *         size *= src.shape[i]             # <<<<<<<<<<<<<<
 * 
 *     return size
 */
    __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
  }

  /* "View.MemoryView":1181
 *         size *= src.shape[i]
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
 */
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1173
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1184
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

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) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1193
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1194
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride = stride * shape[idx]
 */
    __pyx_t_2 = __pyx_v_ndim;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_idx = __pyx_t_4;

      /* "View.MemoryView":1195
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride = stride * shape[idx]
 *     else:
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1196
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1193
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1198
 *             stride = stride * shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride = stride * shape[idx]
 */
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1199
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride = stride * shape[idx]
 * 
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1200
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1202
 *             stride = stride * shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 */
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1184
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1205
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

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) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;

  /* "View.MemoryView":1216
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1217
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
 */
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1219
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err(MemoryError, NULL)
 */
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1220
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1221
 *     result = malloc(size)
 *     if not result:
 *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error)

    /* "View.MemoryView":1220
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  }

  /* "View.MemoryView":1224
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 */
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1225
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 */
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1226
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
 */
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1227
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1228
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
 */
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1230
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
 *                               ndim, order)
 * 
 */
  (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));

  /* "View.MemoryView":1234
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
 */
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1235
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1236
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
 */
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1235
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    }
  }

  /* "View.MemoryView":1238
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1239
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 */
    (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));

    /* "View.MemoryView":1238
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":1241
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1243
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1205
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1248
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1251
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "View.MemoryView":1250
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
 *                                                         (i, extent1, extent2))
 * 
 */
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __PYX_ERR(1, 1250, __pyx_L1_error)

  /* "View.MemoryView":1248
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1254
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1255
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
 *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
 */
  __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(1, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_error);
  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 1255, __pyx_L1_error)

  /* "View.MemoryView":1254
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1258
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1259
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":1260
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
 *     else:
 *         raise error
 */
    __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(1, 1260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_error);
    __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 1260, __pyx_L1_error)

    /* "View.MemoryView":1259
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  }

  /* "View.MemoryView":1262
 *         raise error(msg.decode('ascii'))
 *     else:
 *         raise error             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_contents')
 */
  /*else*/ {
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    __PYX_ERR(1, 1262, __pyx_L1_error)
  }

  /* "View.MemoryView":1258
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1265
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

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) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  void *__pyx_t_7;
  int __pyx_t_8;

  /* "View.MemoryView":1273
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 */
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1274
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 */
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1276
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
 */
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1277
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
 */
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1278
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
 */
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1281
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1282
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1281
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1283
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1284
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1283
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":1286
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1288
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 */
  __pyx_t_5 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_5;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1289
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1290
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":1291
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
 */
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1292
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 */
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1290
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":1294
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
 */
      /*else*/ {
        __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(1, 1294, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1289
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    }

    /* "View.MemoryView":1296
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1297
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 */
      __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(1, 1297, __pyx_L1_error)

      /* "View.MemoryView":1296
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    }
  }

  /* "View.MemoryView":1299
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1301
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1302
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 */
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1301
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    }

    /* "View.MemoryView":1304
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
 */
    __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(1, 1304, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_7;

    /* "View.MemoryView":1305
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
 */
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1299
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  }

  /* "View.MemoryView":1307
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1310
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1311
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1310
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
      goto __pyx_L12;
    }

    /* "View.MemoryView":1312
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1313
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1312
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    }
    __pyx_L12:;

    /* "View.MemoryView":1315
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_2 = (__pyx_v_direct_copy != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1317
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1318
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 */
      (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));

      /* "View.MemoryView":1319
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1320
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1321
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1315
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    }

    /* "View.MemoryView":1307
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1323
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (__pyx_t_8) {

    /* "View.MemoryView":1326
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1326, __pyx_L1_error)

    /* "View.MemoryView":1327
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1327, __pyx_L1_error)

    /* "View.MemoryView":1323
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1329
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1330
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 */
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1331
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1333
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1334
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1265
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1337
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1341
 *                             int ndim_other) nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1343
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1344
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 */
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1345
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 */
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1346
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
 */
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1348
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 */
  __pyx_t_1 = __pyx_v_offset;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1349
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
 */
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1350
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1351
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1337
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1359
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

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) {
  int __pyx_t_1;

  /* "View.MemoryView":1363
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1364
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
 *                                            dst.strides, ndim, inc)
 * 
 */
    __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);

    /* "View.MemoryView":1363
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  }

  /* "View.MemoryView":1359
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

  /* function exit code */
}

/* "View.MemoryView":1368
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

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) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);

  /* "View.MemoryView":1371
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 */
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1368
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "View.MemoryView":1374
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

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) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);

  /* "View.MemoryView":1378
 *     cdef Py_ssize_t i
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
 */
  __pyx_t_1 = (__pyx_v_shape[0]);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1379
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
    __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":1380
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
      __pyx_t_4 = (__pyx_v_inc != 0);
      if (__pyx_t_4) {

        /* "View.MemoryView":1381
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
 */
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1380
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
        goto __pyx_L6;
      }

      /* "View.MemoryView":1383
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 */
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1379
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":1385
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                       ndim - 1, inc)
 * 
 */
    /*else*/ {

      /* "View.MemoryView":1386
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += strides[0]
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1388
 *                                       ndim - 1, inc)
 * 
 *         data += strides[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  }

  /* "View.MemoryView":1374
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1394
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

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) {

  /* "View.MemoryView":1397
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1398
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)
 */
  __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);

  /* "View.MemoryView":1400
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1394
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1404
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

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) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;

  /* "View.MemoryView":1408
 *                               size_t itemsize, void *item) nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
 */
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1409
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1411
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1412
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
 */
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1413
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
 */
      (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));

      /* "View.MemoryView":1414
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1411
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1416
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1417
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                 ndim - 1, itemsize, item)
 *             data += stride
 */
      __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);

      /* "View.MemoryView":1419
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1404
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

  /* function exit code */
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
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};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __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);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 */
    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(1, 9, __pyx_L1_error)
    __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(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __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);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_6pyross_9inference_SIR_type __pyx_vtable_6pyross_9inference_SIR_type;

static PyObject *__pyx_tp_new_6pyross_9inference_SIR_type(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SIR_type *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SIR_type *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pyross_9inference_SIR_type;
  p->beta = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->gIa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->gIs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->fsa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_xm = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->alpha = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->fi = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->CM = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->dsigmadt = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->J = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->J_mat = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->B_vec = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->U = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->flat_indices1 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->flat_indices2 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->flat_indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->rows = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->cols = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->det_method = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->lyapunov_method = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->class_index_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->param_keys = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_interp = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->contactMatrix = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SIR_type(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SIR_type *p = (struct __pyx_obj_6pyross_9inference_SIR_type *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->beta);
  Py_CLEAR(p->gIa);
  Py_CLEAR(p->gIs);
  Py_CLEAR(p->fsa);
  Py_CLEAR(p->_xm);
  Py_CLEAR(p->alpha);
  Py_CLEAR(p->fi);
  Py_CLEAR(p->CM);
  Py_CLEAR(p->dsigmadt);
  Py_CLEAR(p->J);
  Py_CLEAR(p->B);
  Py_CLEAR(p->J_mat);
  Py_CLEAR(p->B_vec);
  Py_CLEAR(p->U);
  Py_CLEAR(p->flat_indices1);
  Py_CLEAR(p->flat_indices2);
  Py_CLEAR(p->flat_indices);
  Py_CLEAR(p->rows);
  Py_CLEAR(p->cols);
  Py_CLEAR(p->det_method);
  Py_CLEAR(p->lyapunov_method);
  Py_CLEAR(p->class_index_dict);
  Py_CLEAR(p->param_keys);
  Py_CLEAR(p->_interp);
  Py_CLEAR(p->contactMatrix);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SIR_type(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SIR_type *p = (struct __pyx_obj_6pyross_9inference_SIR_type *)o;
  if (p->beta) {
    e = (*v)(((PyObject *)p->beta), a); if (e) return e;
  }
  if (p->gIa) {
    e = (*v)(((PyObject *)p->gIa), a); if (e) return e;
  }
  if (p->gIs) {
    e = (*v)(((PyObject *)p->gIs), a); if (e) return e;
  }
  if (p->fsa) {
    e = (*v)(((PyObject *)p->fsa), a); if (e) return e;
  }
  if (p->_xm) {
    e = (*v)(((PyObject *)p->_xm), a); if (e) return e;
  }
  if (p->alpha) {
    e = (*v)(((PyObject *)p->alpha), a); if (e) return e;
  }
  if (p->fi) {
    e = (*v)(((PyObject *)p->fi), a); if (e) return e;
  }
  if (p->CM) {
    e = (*v)(((PyObject *)p->CM), a); if (e) return e;
  }
  if (p->dsigmadt) {
    e = (*v)(((PyObject *)p->dsigmadt), a); if (e) return e;
  }
  if (p->J) {
    e = (*v)(((PyObject *)p->J), a); if (e) return e;
  }
  if (p->B) {
    e = (*v)(((PyObject *)p->B), a); if (e) return e;
  }
  if (p->J_mat) {
    e = (*v)(((PyObject *)p->J_mat), a); if (e) return e;
  }
  if (p->B_vec) {
    e = (*v)(((PyObject *)p->B_vec), a); if (e) return e;
  }
  if (p->U) {
    e = (*v)(((PyObject *)p->U), a); if (e) return e;
  }
  if (p->flat_indices1) {
    e = (*v)(((PyObject *)p->flat_indices1), a); if (e) return e;
  }
  if (p->flat_indices2) {
    e = (*v)(((PyObject *)p->flat_indices2), a); if (e) return e;
  }
  if (p->flat_indices) {
    e = (*v)(((PyObject *)p->flat_indices), a); if (e) return e;
  }
  if (p->rows) {
    e = (*v)(((PyObject *)p->rows), a); if (e) return e;
  }
  if (p->cols) {
    e = (*v)(((PyObject *)p->cols), a); if (e) return e;
  }
  if (p->class_index_dict) {
    e = (*v)(p->class_index_dict, a); if (e) return e;
  }
  if (p->param_keys) {
    e = (*v)(p->param_keys, a); if (e) return e;
  }
  if (p->_interp) {
    e = (*v)(p->_interp, a); if (e) return e;
  }
  if (p->contactMatrix) {
    e = (*v)(p->contactMatrix, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SIR_type(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SIR_type *p = (struct __pyx_obj_6pyross_9inference_SIR_type *)o;
  tmp = ((PyObject*)p->beta);
  p->beta = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->gIa);
  p->gIa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->gIs);
  p->gIs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fsa);
  p->fsa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_xm);
  p->_xm = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->alpha);
  p->alpha = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fi);
  p->fi = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->CM);
  p->CM = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->dsigmadt);
  p->dsigmadt = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->J);
  p->J = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->B);
  p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->J_mat);
  p->J_mat = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->B_vec);
  p->B_vec = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->U);
  p->U = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->flat_indices1);
  p->flat_indices1 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->flat_indices2);
  p->flat_indices2 = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->flat_indices);
  p->flat_indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rows);
  p->rows = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cols);
  p->cols = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->class_index_dict);
  p->class_index_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->param_keys);
  p->param_keys = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_interp);
  p->_interp = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->contactMatrix);
  p->contactMatrix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_nClass(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_6nClass_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_M(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_1M_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_steps(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_5steps_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_dim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_3dim_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_vec_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_8vec_size_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_Omega(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_5Omega_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_rtol_det(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_8rtol_det_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_rtol_lyapunov(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_13rtol_lyapunov_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_beta(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_4beta_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_gIa(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_3gIa_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_gIs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_3gIs_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_fsa(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_3fsa_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type__xm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_3_xm_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_alpha(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_5alpha_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_fi(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_2fi_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_CM(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_2CM_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_dsigmadt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_8dsigmadt_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_J(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_1J_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_B(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_1B_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_J_mat(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_5J_mat_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_B_vec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_5B_vec_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_U(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_1U_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_flat_indices1(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_13flat_indices1_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_flat_indices2(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_13flat_indices2_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_flat_indices(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_12flat_indices_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_rows(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_4rows_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_cols(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_4cols_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_det_method(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_10det_method_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_lyapunov_method(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_15lyapunov_method_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_class_index_dict(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_16class_index_dict_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_param_keys(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_10param_keys_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type__interp(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_7_interp_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_contactMatrix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_13contactMatrix_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SIR_type_param_mapping_enabled(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SIR_type_21param_mapping_enabled_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SIR_type[] = {
  {"infer_parameters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_3infer_parameters, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_2infer_parameters},
  {"nested_sampling_inference", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_5nested_sampling_inference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_4nested_sampling_inference},
  {"nested_sampling_inference_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_7nested_sampling_inference_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_6nested_sampling_inference_process_result},
  {"mcmc_inference", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_9mcmc_inference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_8mcmc_inference},
  {"mcmc_inference_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_11mcmc_inference_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_10mcmc_inference_process_result},
  {"infer_control", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_13infer_control, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_12infer_control},
  {"_loglikelihood", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_15_loglikelihood, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_14_loglikelihood},
  {"_logposterior", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_17_logposterior, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_16_logposterior},
  {"_infer_to_minimize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_19_infer_to_minimize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_18_infer_to_minimize},
  {"infer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_21infer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_20infer},
  {"_nested_sampling_prior_transform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_23_nested_sampling_prior_transform, METH_VARARGS|METH_KEYWORDS, 0},
  {"infer_nested_sampling", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_25infer_nested_sampling, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_24infer_nested_sampling},
  {"infer_nested_sampling_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_27infer_nested_sampling_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_26infer_nested_sampling_process_result},
  {"infer_mcmc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_29infer_mcmc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_28infer_mcmc},
  {"infer_mcmc_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_31infer_mcmc_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_30infer_mcmc_process_result},
  {"_mean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_33_mean, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_32_mean},
  {"_cov", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_35_cov, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_34_cov},
  {"FIM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_37FIM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_36FIM},
  {"FIM_det", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_39FIM_det, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_38FIM_det},
  {"hessian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_41hessian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_40hessian},
  {"robustness", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_43robustness, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_42robustness},
  {"sensitivity", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_45sensitivity, METH_O, __pyx_doc_6pyross_9inference_8SIR_type_44sensitivity},
  {"sample_gaussian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_47sample_gaussian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_46sample_gaussian},
  {"evidence_laplace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_49evidence_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_48evidence_laplace},
  {"obtain_minus_log_p", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_51obtain_minus_log_p, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_50obtain_minus_log_p},
  {"_all_positive", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_53_all_positive, METH_O, 0},
  {"latent_infer_parameters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_55latent_infer_parameters, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_54latent_infer_parameters},
  {"nested_sampling_latent_inference", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_57nested_sampling_latent_inference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_56nested_sampling_latent_inference},
  {"nested_sampling_latent_inference_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_59nested_sampling_latent_inference_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_58nested_sampling_latent_inference_process_result},
  {"mcmc_latent_inference", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_61mcmc_latent_inference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_60mcmc_latent_inference},
  {"mcmc_latent_inference_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_63mcmc_latent_inference_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_62mcmc_latent_inference_process_result},
  {"latent_infer_control", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_65latent_infer_control, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_64latent_infer_control},
  {"_loglikelihood_latent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_67_loglikelihood_latent, METH_VARARGS|METH_KEYWORDS, 0},
  {"_logposterior_latent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_69_logposterior_latent, METH_VARARGS|METH_KEYWORDS, 0},
  {"_latent_infer_to_minimize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_71_latent_infer_to_minimize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_70_latent_infer_to_minimize},
  {"latent_infer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_73latent_infer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_72latent_infer},
  {"latent_infer_nested_sampling", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_75latent_infer_nested_sampling, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_74latent_infer_nested_sampling},
  {"latent_infer_nested_sampling_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_77latent_infer_nested_sampling_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_76latent_infer_nested_sampling_process_result},
  {"latent_infer_mcmc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_79latent_infer_mcmc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_78latent_infer_mcmc},
  {"latent_infer_mcmc_process_result", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_81latent_infer_mcmc_process_result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_80latent_infer_mcmc_process_result},
  {"_latent_mean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_83_latent_mean, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_82_latent_mean},
  {"_latent_cov", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_85_latent_cov, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_84_latent_cov},
  {"latent_FIM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_87latent_FIM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_86latent_FIM},
  {"latent_FIM_det", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_89latent_FIM_det, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_88latent_FIM_det},
  {"latent_hessian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_91latent_hessian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_90latent_hessian},
  {"sample_gaussian_latent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_93sample_gaussian_latent, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_92sample_gaussian_latent},
  {"latent_evidence_laplace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_95latent_evidence_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_94latent_evidence_laplace},
  {"minus_logp_red", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_97minus_logp_red, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_96minus_logp_red},
  {"sample_endpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_99sample_endpoints, METH_VARARGS|METH_KEYWORDS, 0},
  {"sample_trajs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_101sample_trajs, METH_VARARGS|METH_KEYWORDS, 0},
  {"get_mean_inits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_103get_mean_inits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_102get_mean_inits},
  {"find_fastest_growing_lin_mode", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_105find_fastest_growing_lin_mode, METH_O, 0},
  {"set_lyapunov_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_107set_lyapunov_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_106set_lyapunov_method},
  {"set_det_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_109set_det_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_108set_det_method},
  {"set_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_111set_det_model, METH_O, __pyx_doc_6pyross_9inference_8SIR_type_110set_det_model},
  {"set_contact_matrix", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_113set_contact_matrix, METH_O, __pyx_doc_6pyross_9inference_8SIR_type_112set_contact_matrix},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_115make_params_dict, METH_NOARGS, 0},
  {"fill_params_dict", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_117fill_params_dict, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_116fill_params_dict},
  {"set_params", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_119set_params, METH_O, __pyx_doc_6pyross_9inference_8SIR_type_118set_params},
  {"_construct_inits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_121_construct_inits, METH_VARARGS|METH_KEYWORDS, 0},
  {"_lin_mode_inits", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_123_lin_mode_inits, METH_O, 0},
  {"_mean_cov_for_lat_endpoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_125_mean_cov_for_lat_endpoint, METH_VARARGS|METH_KEYWORDS, 0},
  {"_mean_cov_for_lat_traj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_127_mean_cov_for_lat_traj, METH_VARARGS|METH_KEYWORDS, 0},
  {"_split_spaces", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_129_split_spaces, METH_VARARGS|METH_KEYWORDS, 0},
  {"obtain_full_mean_cov", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_131obtain_full_mean_cov, METH_VARARGS|METH_KEYWORDS, 0},
  {"interpolate_euler", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_133interpolate_euler, METH_O, 0},
  {"obtain_full_mean_cov_tangent_space", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_135obtain_full_mean_cov_tangent_space, METH_VARARGS|METH_KEYWORDS, 0},
  {"_rhs0", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_137_rhs0, METH_VARARGS|METH_KEYWORDS, 0},
  {"_obtain_time_evol_op_2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_139_obtain_time_evol_op_2, METH_VARARGS|METH_KEYWORDS, 0},
  {"_obtain_time_evol_op", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_141_obtain_time_evol_op, METH_VARARGS|METH_KEYWORDS, 0},
  {"_solve_lyapunov_type_eq", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_143_solve_lyapunov_type_eq, METH_VARARGS|METH_KEYWORDS, 0},
  {"convert_vec_to_mat", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_145convert_vec_to_mat, METH_O, 0},
  {"_process_contact_matrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_147_process_contact_matrix, METH_VARARGS|METH_KEYWORDS, 0},
  {"integrate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_8SIR_type_149integrate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pyross_9inference_8SIR_type_148integrate},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_151__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_8SIR_type_153__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SIR_type[] = {
  {(char *)"nClass", __pyx_getprop_6pyross_9inference_8SIR_type_nClass, 0, (char *)0, 0},
  {(char *)"M", __pyx_getprop_6pyross_9inference_8SIR_type_M, 0, (char *)0, 0},
  {(char *)"steps", __pyx_getprop_6pyross_9inference_8SIR_type_steps, 0, (char *)0, 0},
  {(char *)"dim", __pyx_getprop_6pyross_9inference_8SIR_type_dim, 0, (char *)0, 0},
  {(char *)"vec_size", __pyx_getprop_6pyross_9inference_8SIR_type_vec_size, 0, (char *)0, 0},
  {(char *)"Omega", __pyx_getprop_6pyross_9inference_8SIR_type_Omega, 0, (char *)0, 0},
  {(char *)"rtol_det", __pyx_getprop_6pyross_9inference_8SIR_type_rtol_det, 0, (char *)0, 0},
  {(char *)"rtol_lyapunov", __pyx_getprop_6pyross_9inference_8SIR_type_rtol_lyapunov, 0, (char *)0, 0},
  {(char *)"beta", __pyx_getprop_6pyross_9inference_8SIR_type_beta, 0, (char *)0, 0},
  {(char *)"gIa", __pyx_getprop_6pyross_9inference_8SIR_type_gIa, 0, (char *)0, 0},
  {(char *)"gIs", __pyx_getprop_6pyross_9inference_8SIR_type_gIs, 0, (char *)0, 0},
  {(char *)"fsa", __pyx_getprop_6pyross_9inference_8SIR_type_fsa, 0, (char *)0, 0},
  {(char *)"_xm", __pyx_getprop_6pyross_9inference_8SIR_type__xm, 0, (char *)0, 0},
  {(char *)"alpha", __pyx_getprop_6pyross_9inference_8SIR_type_alpha, 0, (char *)0, 0},
  {(char *)"fi", __pyx_getprop_6pyross_9inference_8SIR_type_fi, 0, (char *)0, 0},
  {(char *)"CM", __pyx_getprop_6pyross_9inference_8SIR_type_CM, 0, (char *)0, 0},
  {(char *)"dsigmadt", __pyx_getprop_6pyross_9inference_8SIR_type_dsigmadt, 0, (char *)0, 0},
  {(char *)"J", __pyx_getprop_6pyross_9inference_8SIR_type_J, 0, (char *)0, 0},
  {(char *)"B", __pyx_getprop_6pyross_9inference_8SIR_type_B, 0, (char *)0, 0},
  {(char *)"J_mat", __pyx_getprop_6pyross_9inference_8SIR_type_J_mat, 0, (char *)0, 0},
  {(char *)"B_vec", __pyx_getprop_6pyross_9inference_8SIR_type_B_vec, 0, (char *)0, 0},
  {(char *)"U", __pyx_getprop_6pyross_9inference_8SIR_type_U, 0, (char *)0, 0},
  {(char *)"flat_indices1", __pyx_getprop_6pyross_9inference_8SIR_type_flat_indices1, 0, (char *)0, 0},
  {(char *)"flat_indices2", __pyx_getprop_6pyross_9inference_8SIR_type_flat_indices2, 0, (char *)0, 0},
  {(char *)"flat_indices", __pyx_getprop_6pyross_9inference_8SIR_type_flat_indices, 0, (char *)0, 0},
  {(char *)"rows", __pyx_getprop_6pyross_9inference_8SIR_type_rows, 0, (char *)0, 0},
  {(char *)"cols", __pyx_getprop_6pyross_9inference_8SIR_type_cols, 0, (char *)0, 0},
  {(char *)"det_method", __pyx_getprop_6pyross_9inference_8SIR_type_det_method, 0, (char *)0, 0},
  {(char *)"lyapunov_method", __pyx_getprop_6pyross_9inference_8SIR_type_lyapunov_method, 0, (char *)0, 0},
  {(char *)"class_index_dict", __pyx_getprop_6pyross_9inference_8SIR_type_class_index_dict, 0, (char *)0, 0},
  {(char *)"param_keys", __pyx_getprop_6pyross_9inference_8SIR_type_param_keys, 0, (char *)0, 0},
  {(char *)"_interp", __pyx_getprop_6pyross_9inference_8SIR_type__interp, 0, (char *)0, 0},
  {(char *)"contactMatrix", __pyx_getprop_6pyross_9inference_8SIR_type_contactMatrix, 0, (char *)0, 0},
  {(char *)"param_mapping_enabled", __pyx_getprop_6pyross_9inference_8SIR_type_param_mapping_enabled, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SIR_type = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SIR_type", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SIR_type), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SIR_type, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Parent class for inference for all SIR-type classes listed below\n\n    All subclasses use the same functions to perform inference, which are documented below.\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SIR_type, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SIR_type, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SIR_type, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SIR_type, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_8SIR_type_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SIR_type, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SIR __pyx_vtable_6pyross_9inference_SIR;

static PyObject *__pyx_tp_new_6pyross_9inference_SIR(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SIR *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_SIR_type(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SIR *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SIR;
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SIR *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SIR(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SIR *p = (struct __pyx_obj_6pyross_9inference_SIR *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->det_model);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_SIR_type(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SIR(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SIR *p = (struct __pyx_obj_6pyross_9inference_SIR *)o;
  e = __pyx_tp_traverse_6pyross_9inference_SIR_type(o, v, a); if (e) return e;
  if (p->det_model) {
    e = (*v)(((PyObject *)p->det_model), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SIR(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SIR *p = (struct __pyx_obj_6pyross_9inference_SIR *)o;
  __pyx_tp_clear_6pyross_9inference_SIR_type(o);
  tmp = ((PyObject*)p->det_model);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SIR *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_3SIR_det_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3SIR_9det_model_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SIR[] = {
  {"set_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_3SIR_3set_det_model, METH_O, 0},
  {"infection_indices", (PyCFunction)__pyx_pw_6pyross_9inference_3SIR_5infection_indices, METH_NOARGS, 0},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_3SIR_7make_params_dict, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_3SIR_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_3SIR_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SIR[] = {
  {(char *)"det_model", __pyx_getprop_6pyross_9inference_3SIR_det_model, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SIR = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SIR", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SIR), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SIR, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Susceptible, Infected, Removed (SIR)\n\n    * Ia: asymptomatic\n    * Is: symptomatic\n\n    To initialise the SIR class,\n\n    Parameters\n    ----------\n    parameters: dict\n        Contains the following keys:\n\n        alpha: float\n            Ratio of asymptomatic carriers\n        beta: float\n            Infection rate upon contact\n        gIa: float\n            Recovery rate for asymptomatic\n        gIs: float\n            Recovery rate for symptomatic\n        fsa: float\n            Fraction by which symptomatic individuals do not self-isolate.\n    M: int\n        Number of age groups\n    fi: float numpy.array\n        Number of people in each age group divided by Omega.\n    Omega: float, optional\n        System size parameter, e.g. total population. Default to 1.\n    steps: int, optional\n        The number of internal integration steps performed between the observed points (not used in tangent space inference).\n        For robustness, set steps to be large, lyapunov_method='LSODA'.\n        For speed, set steps to be small (~4), lyapunov_method='euler'.\n        For a combination of the two, choose something in between.\n    det_method: str, optional\n        The integration method used for deterministic integration.\n        Choose one of 'LSODA' and 'RK45'. Default is 'LSODA'.\n    lyapunov_method: str, optional\n        The integration method used for the integration of the Lyapunov equation for the covariance.\n        Choose one of 'LSODA', 'RK45', 'RK2' and 'euler'. Default is 'LSODA'.\n    rtol_det: float, optional\n        relative tolerance for the deterministic integrator (default 1e-4)\n    rtol_lyapunov: float, optional\n        relative tolerance for the Lyapunov-type integrator (default 1e-3)\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SIR, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SIR, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SIR, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SIR, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_3SIR_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SIR, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SEIR __pyx_vtable_6pyross_9inference_SEIR;

static PyObject *__pyx_tp_new_6pyross_9inference_SEIR(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SEIR *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_SIR_type(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SEIR *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SEIR;
  p->gE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEIR *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SEIR(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SEIR *p = (struct __pyx_obj_6pyross_9inference_SEIR *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->gE);
  Py_CLEAR(p->det_model);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_SIR_type(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SEIR(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SEIR *p = (struct __pyx_obj_6pyross_9inference_SEIR *)o;
  e = __pyx_tp_traverse_6pyross_9inference_SIR_type(o, v, a); if (e) return e;
  if (p->gE) {
    e = (*v)(((PyObject *)p->gE), a); if (e) return e;
  }
  if (p->det_model) {
    e = (*v)(((PyObject *)p->det_model), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SEIR(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SEIR *p = (struct __pyx_obj_6pyross_9inference_SEIR *)o;
  __pyx_tp_clear_6pyross_9inference_SIR_type(o);
  tmp = ((PyObject*)p->gE);
  p->gE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->det_model);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEIR *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_4SEIR_gE(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_4SEIR_2gE_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_4SEIR_det_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_4SEIR_9det_model_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SEIR[] = {
  {"infection_indices", (PyCFunction)__pyx_pw_6pyross_9inference_4SEIR_3infection_indices, METH_NOARGS, 0},
  {"set_params", (PyCFunction)__pyx_pw_6pyross_9inference_4SEIR_5set_params, METH_O, 0},
  {"set_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_4SEIR_7set_det_model, METH_O, 0},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_4SEIR_9make_params_dict, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_4SEIR_11__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_4SEIR_13__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SEIR[] = {
  {(char *)"gE", __pyx_getprop_6pyross_9inference_4SEIR_gE, 0, (char *)0, 0},
  {(char *)"det_model", __pyx_getprop_6pyross_9inference_4SEIR_det_model, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SEIR = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SEIR", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SEIR), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SEIR, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Susceptible, Exposed, Infected, Removed (SEIR)\n\n    * Ia: asymptomatic\n    * Is: symptomatic\n\n    To initialise the SEIR class,\n\n    Parameters\n    ----------\n    parameters: dict\n        Contains the following keys:\n\n        alpha: float or np.array(M)\n            Fraction of infected who are asymptomatic.\n        beta: float\n            Rate of spread of infection.\n        gIa: float\n            Rate of removal from asymptomatic individuals.\n        gIs: float\n            Rate of removal from symptomatic individuals.\n        fsa: float\n            Fraction by which symptomatic individuals do not self-isolate.\n        gE: float\n            rate of removal from exposed individuals.\n    M: int\n        Number of age groups\n    fi: float numpy.array\n        Number of people in each compartment divided by Omega\n    Omega: float, optional\n        System size, e.g. total population. Default is 1.\n    steps: int, optional\n        The number of internal integration steps performed between the observed points (not used in tangent space inference).\n        For robustness, set steps to be large, lyapunov_method='LSODA'.\n        For speed, set steps to be small (~4), lyapunov_method='euler'.\n        For a combination of the two, choose something in between.\n    det_method: str, optional\n        The integration method used for deterministic integration.\n        Choose one of 'LSODA' and 'RK45'. Default is 'LSODA'.\n    lyapunov_method: str, optional\n        The integration method used for the integration of the Lyapunov equation for the covariance.\n        Choose one of 'LSODA', 'RK45', 'RK2' and 'euler'. Default is 'LSODA'.\n    rtol_det: float, optional\n        relative tolerance for the deterministic integrator (default 1e-3)\n    rtol_lyapunov: float, optional\n        relative tolerance for the Lyapunov-type integrator (default 1e-3)\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SEIR, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SEIR, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SEIR, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SEIR, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_4SEIR_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SEIR, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ __pyx_vtable_6pyross_9inference_SEAIRQ;

static PyObject *__pyx_tp_new_6pyross_9inference_SEAIRQ(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SEAIRQ *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_SIR_type(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SEAIRQ *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SEAIRQ;
  p->gE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->gA = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->tE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->tA = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->tIa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->tIs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SEAIRQ(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SEAIRQ *p = (struct __pyx_obj_6pyross_9inference_SEAIRQ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->gE);
  Py_CLEAR(p->gA);
  Py_CLEAR(p->tE);
  Py_CLEAR(p->tA);
  Py_CLEAR(p->tIa);
  Py_CLEAR(p->tIs);
  Py_CLEAR(p->det_model);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_SIR_type(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SEAIRQ(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SEAIRQ *p = (struct __pyx_obj_6pyross_9inference_SEAIRQ *)o;
  e = __pyx_tp_traverse_6pyross_9inference_SIR_type(o, v, a); if (e) return e;
  if (p->gE) {
    e = (*v)(((PyObject *)p->gE), a); if (e) return e;
  }
  if (p->gA) {
    e = (*v)(((PyObject *)p->gA), a); if (e) return e;
  }
  if (p->tE) {
    e = (*v)(((PyObject *)p->tE), a); if (e) return e;
  }
  if (p->tA) {
    e = (*v)(((PyObject *)p->tA), a); if (e) return e;
  }
  if (p->tIa) {
    e = (*v)(((PyObject *)p->tIa), a); if (e) return e;
  }
  if (p->tIs) {
    e = (*v)(((PyObject *)p->tIs), a); if (e) return e;
  }
  if (p->det_model) {
    e = (*v)(((PyObject *)p->det_model), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SEAIRQ(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SEAIRQ *p = (struct __pyx_obj_6pyross_9inference_SEAIRQ *)o;
  __pyx_tp_clear_6pyross_9inference_SIR_type(o);
  tmp = ((PyObject*)p->gE);
  p->gE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->gA);
  p->gA = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tE);
  p->tE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tA);
  p->tA = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tIa);
  p->tIa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tIs);
  p->tIs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->det_model);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_gE(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_2gE_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_gA(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_2gA_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_tE(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_2tE_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_tA(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_2tA_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_tIa(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_3tIa_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_tIs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_3tIs_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_6SEAIRQ_det_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_6SEAIRQ_9det_model_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SEAIRQ[] = {
  {"infection_indices", (PyCFunction)__pyx_pw_6pyross_9inference_6SEAIRQ_3infection_indices, METH_NOARGS, 0},
  {"set_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_6SEAIRQ_5set_det_model, METH_O, 0},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_6SEAIRQ_7make_params_dict, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_6SEAIRQ_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_6SEAIRQ_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SEAIRQ[] = {
  {(char *)"gE", __pyx_getprop_6pyross_9inference_6SEAIRQ_gE, 0, (char *)0, 0},
  {(char *)"gA", __pyx_getprop_6pyross_9inference_6SEAIRQ_gA, 0, (char *)0, 0},
  {(char *)"tE", __pyx_getprop_6pyross_9inference_6SEAIRQ_tE, 0, (char *)0, 0},
  {(char *)"tA", __pyx_getprop_6pyross_9inference_6SEAIRQ_tA, 0, (char *)0, 0},
  {(char *)"tIa", __pyx_getprop_6pyross_9inference_6SEAIRQ_tIa, 0, (char *)0, 0},
  {(char *)"tIs", __pyx_getprop_6pyross_9inference_6SEAIRQ_tIs, 0, (char *)0, 0},
  {(char *)"det_model", __pyx_getprop_6pyross_9inference_6SEAIRQ_det_model, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SEAIRQ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SEAIRQ", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SEAIRQ), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SEAIRQ, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)\n\n    * Ia: asymptomatic\n    * Is: symptomatic\n    * E: exposed\n    * A: asymptomatic and infectious\n    * Q: quarantined\n\n    To initialise the SEAIRQ class,\n\n    Parameters\n    ----------\n    parameters: dict\n        Contains the following keys:\n\n        alpha: float or np.array(M)\n            Fraction of infected who are asymptomatic.\n        beta: float\n            Rate of spread of infection.\n        gIa: float\n            Rate of removal from asymptomatic individuals.\n        gIs: float\n            Rate of removal from symptomatic individuals.\n        gE: float\n            rate of removal from exposed individuals.\n        gA: float\n            rate of removal from activated individuals.\n        fsa: float\n            Fraction by which symptomatic individuals do not self-isolate.\n        tE: float\n            testing rate and contact tracing of exposeds\n        tA: float\n            testing rate and contact tracing of activateds\n        tIa: float\n            testing rate and contact tracing of asymptomatics\n        tIs: float\n            testing rate and contact tracing of symptomatics\n    M: int\n        Number of compartments\n    fi: float numpy.array\n        Number of people in each compartment divided by Omega.\n    Omega: float, optional\n        System size, e.g. total population. Default is 1.\n    steps: int, optional\n        The number of internal integration steps performed between the observed points (not used in tangent space inference).\n        For robustness, set steps to be large, lyapunov_method='LSODA'.\n        For speed, set steps to be small (~4), lyapunov_method='euler'.\n        For a combination of the two, choose something in between.\n    det_method: str, optional\n        The integration method used for deterministic integration.\n        Choose one of 'LSODA' and 'RK45'. Default is 'LSODA'.\n    lyapu""nov_method: str, optional\n        The integration method used for the integration of the Lyapunov equation for the covariance.\n        Choose one of 'LSODA', 'RK45', 'RK2' and 'euler'. Default is 'LSODA'.\n    rtol_det: float, optional\n        relative tolerance for the deterministic integrator (default 1e-3)\n    rtol_lyapunov: float, optional\n        relative tolerance for the Lyapunov-type integrator (default 1e-3)\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SEAIRQ, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SEAIRQ, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SEAIRQ, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SEAIRQ, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_6SEAIRQ_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SEAIRQ, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SEAIRQ_testing __pyx_vtable_6pyross_9inference_SEAIRQ_testing;

static PyObject *__pyx_tp_new_6pyross_9inference_SEAIRQ_testing(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_SIR_type(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SEAIRQ_testing;
  p->gE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->gA = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->ars = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->kapE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->testRate = Py_None; Py_INCREF(Py_None);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SEAIRQ_testing(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *p = (struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->gE);
  Py_CLEAR(p->gA);
  Py_CLEAR(p->ars);
  Py_CLEAR(p->kapE);
  Py_CLEAR(p->testRate);
  Py_CLEAR(p->det_model);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_SIR_type(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SEAIRQ_testing(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *p = (struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)o;
  e = __pyx_tp_traverse_6pyross_9inference_SIR_type(o, v, a); if (e) return e;
  if (p->gE) {
    e = (*v)(((PyObject *)p->gE), a); if (e) return e;
  }
  if (p->gA) {
    e = (*v)(((PyObject *)p->gA), a); if (e) return e;
  }
  if (p->ars) {
    e = (*v)(((PyObject *)p->ars), a); if (e) return e;
  }
  if (p->kapE) {
    e = (*v)(((PyObject *)p->kapE), a); if (e) return e;
  }
  if (p->testRate) {
    e = (*v)(p->testRate, a); if (e) return e;
  }
  if (p->det_model) {
    e = (*v)(((PyObject *)p->det_model), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SEAIRQ_testing(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *p = (struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *)o;
  __pyx_tp_clear_6pyross_9inference_SIR_type(o);
  tmp = ((PyObject*)p->gE);
  p->gE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->gA);
  p->gA = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ars);
  p->ars = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->kapE);
  p->kapE = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->testRate);
  p->testRate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->det_model);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_14SEAIRQ_testing_gE(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_14SEAIRQ_testing_2gE_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_14SEAIRQ_testing_gA(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_14SEAIRQ_testing_2gA_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_14SEAIRQ_testing_ars(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_14SEAIRQ_testing_3ars_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_14SEAIRQ_testing_kapE(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_14SEAIRQ_testing_4kapE_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_14SEAIRQ_testing_testRate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_14SEAIRQ_testing_8testRate_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_14SEAIRQ_testing_det_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_14SEAIRQ_testing_9det_model_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SEAIRQ_testing[] = {
  {"infection_indices", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_3infection_indices, METH_NOARGS, 0},
  {"set_params", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_5set_params, METH_O, 0},
  {"set_testRate", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_7set_testRate, METH_O, 0},
  {"make_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_9make_det_model, METH_O, 0},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_11make_params_dict, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_13__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_14SEAIRQ_testing_15__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SEAIRQ_testing[] = {
  {(char *)"gE", __pyx_getprop_6pyross_9inference_14SEAIRQ_testing_gE, 0, (char *)0, 0},
  {(char *)"gA", __pyx_getprop_6pyross_9inference_14SEAIRQ_testing_gA, 0, (char *)0, 0},
  {(char *)"ars", __pyx_getprop_6pyross_9inference_14SEAIRQ_testing_ars, 0, (char *)0, 0},
  {(char *)"kapE", __pyx_getprop_6pyross_9inference_14SEAIRQ_testing_kapE, 0, (char *)0, 0},
  {(char *)"testRate", __pyx_getprop_6pyross_9inference_14SEAIRQ_testing_testRate, 0, (char *)0, 0},
  {(char *)"det_model", __pyx_getprop_6pyross_9inference_14SEAIRQ_testing_det_model, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SEAIRQ_testing = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SEAIRQ_testing", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SEAIRQ_testing, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Susceptible, Exposed, Asymptomatic and infected, Infected, Removed, Quarantined (SEAIRQ)\n    Ia: asymptomatic\n    Is: symptomatic\n    A : Asymptomatic and infectious\n\n    * Ia: asymptomatic\n    * Is: symptomatic\n    * E: exposed\n    * A: asymptomatic and infectious\n    * Q: quarantined\n\n    To initialise the SEAIRQ class,\n\n    Parameters\n    ----------\n    parameters: dict\n        Contains the following keys:\n\n        alpha: float or np.array(M)\n            Fraction of infected who are asymptomatic.\n        beta: float\n            Rate of spread of infection.\n        gIa: float\n            Rate of removal from asymptomatic individuals.\n        gIs: float\n            Rate of removal from symptomatic individuals.\n        gE: float\n            rate of removal from exposed individuals.\n        gA: float\n            rate of removal from activated individuals.\n        fsa: float\n            Fraction by which symptomatic individuals do not self-isolate.\n        ars : float\n            fraction of population admissible for random and symptomatic tests\n        kapE : float\n            fraction of positive tests for exposed individuals\n    testRate: python function\n        number of tests per day and age group\n    M: int\n        Number of compartments\n    fi: float numpy.array\n        Number of people in each age group divided by Omega.\n    Omega: float, optional\n        System size, e.g. total population. Default is 1.\n    steps: int, optional\n        The number of internal integration steps performed between the observed points (not used in tangent space inference).\n        For robustness, set steps to be large, lyapunov_method='LSODA'.\n        For speed, set steps to be small (~4), lyapunov_method='euler'.\n        For a combination of the two, choose something in between.\n    det_method: str, optional\n        The integration method used for deterministic integration.\n        Choose one of 'LSODA' and 'RK45'. Default ""is 'LSODA'.\n    lyapunov_method: str, optional\n        The integration method used for the integration of the Lyapunov equation for the covariance.\n        Choose one of 'LSODA', 'RK45', 'RK2' and 'euler'. Default is 'LSODA'.\n    rtol_det: float, optional\n        relative tolerance for the deterministic integrator (default 1e-3)\n    rtol_lyapunov: float, optional\n        relative tolerance for the Lyapunov-type integrator (default 1e-3)\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SEAIRQ_testing, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SEAIRQ_testing, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SEAIRQ_testing, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SEAIRQ_testing, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_14SEAIRQ_testing_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SEAIRQ_testing, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_Spp __pyx_vtable_6pyross_9inference_Spp;

static PyObject *__pyx_tp_new_6pyross_9inference_Spp(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_Spp *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_SIR_type(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_Spp *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_Spp;
  p->constant_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->linear_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->infection_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->finres_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->resource_list = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->model_parameters = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->model_parameters_length = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->finres_pop = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)Py_None); Py_INCREF(Py_None);
  p->model_spec = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->param_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->model_param_keys = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->parameter_mapping = Py_None; Py_INCREF(Py_None);
  p->time_dep_param_mapping = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_Spp(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_Spp *p = (struct __pyx_obj_6pyross_9inference_Spp *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->constant_terms);
  Py_CLEAR(p->linear_terms);
  Py_CLEAR(p->infection_terms);
  Py_CLEAR(p->finres_terms);
  Py_CLEAR(p->resource_list);
  Py_CLEAR(p->model_parameters);
  Py_CLEAR(p->model_parameters_length);
  Py_CLEAR(p->finres_pop);
  Py_CLEAR(p->det_model);
  Py_CLEAR(p->model_spec);
  Py_CLEAR(p->param_dict);
  Py_CLEAR(p->model_param_keys);
  Py_CLEAR(p->parameter_mapping);
  Py_CLEAR(p->time_dep_param_mapping);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_SIR_type(o);
}

static int __pyx_tp_traverse_6pyross_9inference_Spp(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_Spp *p = (struct __pyx_obj_6pyross_9inference_Spp *)o;
  e = __pyx_tp_traverse_6pyross_9inference_SIR_type(o, v, a); if (e) return e;
  if (p->constant_terms) {
    e = (*v)(((PyObject *)p->constant_terms), a); if (e) return e;
  }
  if (p->linear_terms) {
    e = (*v)(((PyObject *)p->linear_terms), a); if (e) return e;
  }
  if (p->infection_terms) {
    e = (*v)(((PyObject *)p->infection_terms), a); if (e) return e;
  }
  if (p->finres_terms) {
    e = (*v)(((PyObject *)p->finres_terms), a); if (e) return e;
  }
  if (p->resource_list) {
    e = (*v)(((PyObject *)p->resource_list), a); if (e) return e;
  }
  if (p->model_parameters) {
    e = (*v)(((PyObject *)p->model_parameters), a); if (e) return e;
  }
  if (p->model_parameters_length) {
    e = (*v)(((PyObject *)p->model_parameters_length), a); if (e) return e;
  }
  if (p->finres_pop) {
    e = (*v)(((PyObject *)p->finres_pop), a); if (e) return e;
  }
  if (p->det_model) {
    e = (*v)(((PyObject *)p->det_model), a); if (e) return e;
  }
  if (p->model_spec) {
    e = (*v)(p->model_spec, a); if (e) return e;
  }
  if (p->param_dict) {
    e = (*v)(p->param_dict, a); if (e) return e;
  }
  if (p->model_param_keys) {
    e = (*v)(p->model_param_keys, a); if (e) return e;
  }
  if (p->parameter_mapping) {
    e = (*v)(p->parameter_mapping, a); if (e) return e;
  }
  if (p->time_dep_param_mapping) {
    e = (*v)(p->time_dep_param_mapping, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_Spp(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_Spp *p = (struct __pyx_obj_6pyross_9inference_Spp *)o;
  __pyx_tp_clear_6pyross_9inference_SIR_type(o);
  tmp = ((PyObject*)p->constant_terms);
  p->constant_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->linear_terms);
  p->linear_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->infection_terms);
  p->infection_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->finres_terms);
  p->finres_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->resource_list);
  p->resource_list = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_parameters);
  p->model_parameters = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_parameters_length);
  p->model_parameters_length = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->finres_pop);
  p->finres_pop = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->det_model);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_Spp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_spec);
  p->model_spec = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->param_dict);
  p->param_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_param_keys);
  p->model_param_keys = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->parameter_mapping);
  p->parameter_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->time_dep_param_mapping);
  p->time_dep_param_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_constant_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_14constant_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_linear_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_12linear_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_infection_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_15infection_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_finres_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_12finres_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_resource_list(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_13resource_list_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_model_parameters(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_16model_parameters_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_model_parameters_length(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_23model_parameters_length_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_finres_pop(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_10finres_pop_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_det_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_9det_model_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_model_spec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_10model_spec_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_param_dict(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_10param_dict_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_model_param_keys(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_16model_param_keys_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_parameter_mapping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_17parameter_mapping_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_3Spp_time_dep_param_mapping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_3Spp_22time_dep_param_mapping_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_Spp[] = {
  {"infection_indices", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_3infection_indices, METH_NOARGS, 0},
  {"set_params", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_5set_params, METH_O, 0},
  {"set_time_dep_model_parameters", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_7set_time_dep_model_parameters, METH_O, 0},
  {"set_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_9set_det_model, METH_O, 0},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_11make_params_dict, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_13__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_3Spp_15__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_Spp[] = {
  {(char *)"constant_terms", __pyx_getprop_6pyross_9inference_3Spp_constant_terms, 0, (char *)0, 0},
  {(char *)"linear_terms", __pyx_getprop_6pyross_9inference_3Spp_linear_terms, 0, (char *)0, 0},
  {(char *)"infection_terms", __pyx_getprop_6pyross_9inference_3Spp_infection_terms, 0, (char *)0, 0},
  {(char *)"finres_terms", __pyx_getprop_6pyross_9inference_3Spp_finres_terms, 0, (char *)0, 0},
  {(char *)"resource_list", __pyx_getprop_6pyross_9inference_3Spp_resource_list, 0, (char *)0, 0},
  {(char *)"model_parameters", __pyx_getprop_6pyross_9inference_3Spp_model_parameters, 0, (char *)0, 0},
  {(char *)"model_parameters_length", __pyx_getprop_6pyross_9inference_3Spp_model_parameters_length, 0, (char *)0, 0},
  {(char *)"finres_pop", __pyx_getprop_6pyross_9inference_3Spp_finres_pop, 0, (char *)0, 0},
  {(char *)"det_model", __pyx_getprop_6pyross_9inference_3Spp_det_model, 0, (char *)0, 0},
  {(char *)"model_spec", __pyx_getprop_6pyross_9inference_3Spp_model_spec, 0, (char *)0, 0},
  {(char *)"param_dict", __pyx_getprop_6pyross_9inference_3Spp_param_dict, 0, (char *)0, 0},
  {(char *)"model_param_keys", __pyx_getprop_6pyross_9inference_3Spp_model_param_keys, 0, (char *)0, 0},
  {(char *)"parameter_mapping", __pyx_getprop_6pyross_9inference_3Spp_parameter_mapping, 0, (char *)0, 0},
  {(char *)"time_dep_param_mapping", __pyx_getprop_6pyross_9inference_3Spp_time_dep_param_mapping, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_Spp = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.Spp", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_Spp), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_Spp, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "User-defined epidemic model.\n\n    To initialise the Spp model,\n\n    Parameters\n    ----------\n    model_spec: dict\n        A dictionary specifying the model. See `Examples`.\n    parameters: dict\n        A dictionary containing the model parameters.\n        All parameters can be float if not age-dependent, and np.array(M,) if age-dependent\n    M: int\n        Number of age groups.\n    fi: np.array(M) or list\n        Fraction of each age group.\n    Omega: int\n        Total population.\n    steps: int, optional\n        The number of internal integration steps performed between the observed points (not used in tangent space inference).\n        For robustness, set steps to be large, lyapunov_method='LSODA'.\n        For speed, set steps to be small (~4), lyapunov_method='euler'.\n        For a combination of the two, choose something in between.\n    det_method: str, optional\n        The integration method used for deterministic integration.\n        Choose one of 'LSODA' and 'RK45'. Default is 'LSODA'.\n    lyapunov_method: str, optional\n        The integration method used for the integration of the Lyapunov equation for the covariance.\n        Choose one of 'LSODA', 'RK45', 'RK2' and 'euler'. Default is 'LSODA'.\n    rtol_det: float, optional\n        relative tolerance for the deterministic integrator (default 1e-3)\n    rtol_lyapunov: float, optional\n        relative tolerance for the Lyapunov-type integrator (default 1e-3)\n    parameter_mapping: python function, optional\n        A user-defined function that maps the dictionary the parameters used for inference to a dictionary of parameters used in model_spec. Default is an identical mapping.\n    time_dep_param_mapping: python function, optional\n        As parameter_mapping, but time-dependent. The user-defined function takes time as a second argument.\n\n    See `SIR_type` for a table of all the methods\n\n    Examples\n    --------\n    An example of model_spec and parameters for SIR class ""with a constant influx\n\n    >>> model_spec = {\n            \"classes\" : [\"S\", \"I\"],\n            \"S\" : {\n                \"constant\"  : [ [\"k\"] ],\n                \"infection\" : [ [\"I\", \"-beta\"] ]\n            },\n            \"I\" : {\n                \"linear\"    : [ [\"I\", \"-gamma\"] ],\n                \"infection\" : [ [\"I\", \"beta\"] ]\n            }\n        }\n    >>> parameters = {\n            'beta': 0.1,\n            'gamma': 0.1,\n            'k': 1,\n        }\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_Spp, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_Spp, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_Spp, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_Spp, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_3Spp_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_Spp, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SppQ __pyx_vtable_6pyross_9inference_SppQ;

static PyObject *__pyx_tp_new_6pyross_9inference_SppQ(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SppQ *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_Spp(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SppQ *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SppQ;
  p->full_model_spec = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->input_time_dep_param_mapping = Py_None; Py_INCREF(Py_None);
  p->input_param_mapping = Py_None; Py_INCREF(Py_None);
  p->testRate = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SppQ(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SppQ *p = (struct __pyx_obj_6pyross_9inference_SppQ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->full_model_spec);
  Py_CLEAR(p->input_time_dep_param_mapping);
  Py_CLEAR(p->input_param_mapping);
  Py_CLEAR(p->testRate);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_Spp(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SppQ(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SppQ *p = (struct __pyx_obj_6pyross_9inference_SppQ *)o;
  e = __pyx_tp_traverse_6pyross_9inference_Spp(o, v, a); if (e) return e;
  if (p->full_model_spec) {
    e = (*v)(p->full_model_spec, a); if (e) return e;
  }
  if (p->input_time_dep_param_mapping) {
    e = (*v)(p->input_time_dep_param_mapping, a); if (e) return e;
  }
  if (p->input_param_mapping) {
    e = (*v)(p->input_param_mapping, a); if (e) return e;
  }
  if (p->testRate) {
    e = (*v)(p->testRate, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SppQ(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SppQ *p = (struct __pyx_obj_6pyross_9inference_SppQ *)o;
  __pyx_tp_clear_6pyross_9inference_Spp(o);
  tmp = ((PyObject*)p->full_model_spec);
  p->full_model_spec = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->input_time_dep_param_mapping);
  p->input_time_dep_param_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->input_param_mapping);
  p->input_param_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->testRate);
  p->testRate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_4SppQ_full_model_spec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_4SppQ_15full_model_spec_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_4SppQ_input_time_dep_param_mapping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_4SppQ_28input_time_dep_param_mapping_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_4SppQ_input_param_mapping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_4SppQ_19input_param_mapping_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_4SppQ_testRate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_4SppQ_8testRate_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SppQ[] = {
  {"full_time_dep_param_mapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pyross_9inference_4SppQ_3full_time_dep_param_mapping, METH_VARARGS|METH_KEYWORDS, 0},
  {"set_testRate", (PyCFunction)__pyx_pw_6pyross_9inference_4SppQ_5set_testRate, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_4SppQ_7__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_4SppQ_9__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SppQ[] = {
  {(char *)"full_model_spec", __pyx_getprop_6pyross_9inference_4SppQ_full_model_spec, 0, (char *)0, 0},
  {(char *)"input_time_dep_param_mapping", __pyx_getprop_6pyross_9inference_4SppQ_input_time_dep_param_mapping, 0, (char *)0, 0},
  {(char *)"input_param_mapping", __pyx_getprop_6pyross_9inference_4SppQ_input_param_mapping, 0, (char *)0, 0},
  {(char *)"testRate", __pyx_getprop_6pyross_9inference_4SppQ_testRate, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SppQ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SppQ", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SppQ), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SppQ, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "User-defined epidemic model with quarantine stage.\n\n    To initialise the SppQ model,\n\n    Parameters\n    ----------\n    model_spec: dict\n        A dictionary specifying the model. See `Examples`.\n    parameters: dict\n        A dictionary containing the model parameters.\n        All parameters can be float if not age-dependent, and np.array(M,) if age-dependent\n    testRate: python function\n        number of tests per day and age group\n    M: int\n        Number of age groups.\n    fi: np.array(M) or list\n        Fraction of each age group.\n    Omega: int\n        Total population.\n    steps: int, optional\n        The number of internal integration steps performed between the observed points (not used in tangent space inference).\n        For robustness, set steps to be large, lyapunov_method='LSODA'.\n        For speed, set steps to be small (~4), lyapunov_method='euler'.\n        For a combination of the two, choose something in between.\n    det_method: str, optional\n        The integration method used for deterministic integration.\n        Choose one of 'LSODA' and 'RK45'. Default is 'LSODA'.\n    lyapunov_method: str, optional\n        The integration method used for the integration of the Lyapunov equation for the covariance.\n        Choose one of 'LSODA', 'RK45', 'RK2' and 'euler'. Default is 'LSODA'.\n    rtol_det: float, optional\n        relative tolerance for the deterministic integrator (default 1e-3)\n    rtol_lyapunov: float, optional\n        relative tolerance for the Lyapunov-type integrator (default 1e-3)\n    parameter_mapping: python function, optional\n        A user-defined function that maps the dictionary the parameters used for inference to a dictionary of parameters used in model_spec. Default is an identical mapping.\n    time_dep_param_mapping: python function, optional\n        As parameter_mapping, but time-dependent. The user-defined function takes time as a second argument.\n\n    See `SIR_type` for a table of all ""the methods\n\n    Examples\n    --------\n    An example of model_spec and parameters for SIR class with random\n    testing (without false positives/negatives) and quarantine\n\n    >>> model_spec = {\n            \"classes\" : [\"S\", \"I\"],\n            \"S\" : {\n                \"infection\" : [ [\"I\", \"-beta\"] ]\n            },\n            \"I\" : {\n                \"linear\"    : [ [\"I\", \"-gamma\"] ],\n                \"infection\" : [ [\"I\", \"beta\"] ]\n            },\n            \"test_pos\"  : [ \"p_falsepos\", \"p_truepos\", \"p_falsepos\"] ,\n            \"test_freq\" : [ \"tf\", \"tf\", \"tf\"]\n        }\n    >>> parameters = {\n            'beta': 0.1,\n            'gamma': 0.1,\n            'p_falsepos': 0\n            'p_truepos': 1\n            'tf': 1\n        }\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SppQ, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SppQ, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SppQ, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SppQ, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_4SppQ_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SppQ, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SppQ_old __pyx_vtable_6pyross_9inference_SppQ_old;

static PyObject *__pyx_tp_new_6pyross_9inference_SppQ_old(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SppQ_old *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_SIR_type(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SppQ_old *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SppQ_old;
  p->constant_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->linear_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->infection_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->test_pos = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->test_freq = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->model_parameters = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SppQ_old *)Py_None); Py_INCREF(Py_None);
  p->model_spec = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->param_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->model_param_keys = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->parameter_mapping = Py_None; Py_INCREF(Py_None);
  p->time_dep_param_mapping = Py_None; Py_INCREF(Py_None);
  p->testRate = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference_SppQ_old(PyObject *o) {
  struct __pyx_obj_6pyross_9inference_SppQ_old *p = (struct __pyx_obj_6pyross_9inference_SppQ_old *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->constant_terms);
  Py_CLEAR(p->linear_terms);
  Py_CLEAR(p->infection_terms);
  Py_CLEAR(p->test_pos);
  Py_CLEAR(p->test_freq);
  Py_CLEAR(p->model_parameters);
  Py_CLEAR(p->det_model);
  Py_CLEAR(p->model_spec);
  Py_CLEAR(p->param_dict);
  Py_CLEAR(p->model_param_keys);
  Py_CLEAR(p->parameter_mapping);
  Py_CLEAR(p->time_dep_param_mapping);
  Py_CLEAR(p->testRate);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pyross_9inference_SIR_type(o);
}

static int __pyx_tp_traverse_6pyross_9inference_SppQ_old(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference_SppQ_old *p = (struct __pyx_obj_6pyross_9inference_SppQ_old *)o;
  e = __pyx_tp_traverse_6pyross_9inference_SIR_type(o, v, a); if (e) return e;
  if (p->constant_terms) {
    e = (*v)(((PyObject *)p->constant_terms), a); if (e) return e;
  }
  if (p->linear_terms) {
    e = (*v)(((PyObject *)p->linear_terms), a); if (e) return e;
  }
  if (p->infection_terms) {
    e = (*v)(((PyObject *)p->infection_terms), a); if (e) return e;
  }
  if (p->test_pos) {
    e = (*v)(((PyObject *)p->test_pos), a); if (e) return e;
  }
  if (p->test_freq) {
    e = (*v)(((PyObject *)p->test_freq), a); if (e) return e;
  }
  if (p->model_parameters) {
    e = (*v)(((PyObject *)p->model_parameters), a); if (e) return e;
  }
  if (p->det_model) {
    e = (*v)(((PyObject *)p->det_model), a); if (e) return e;
  }
  if (p->model_spec) {
    e = (*v)(p->model_spec, a); if (e) return e;
  }
  if (p->param_dict) {
    e = (*v)(p->param_dict, a); if (e) return e;
  }
  if (p->model_param_keys) {
    e = (*v)(p->model_param_keys, a); if (e) return e;
  }
  if (p->parameter_mapping) {
    e = (*v)(p->parameter_mapping, a); if (e) return e;
  }
  if (p->time_dep_param_mapping) {
    e = (*v)(p->time_dep_param_mapping, a); if (e) return e;
  }
  if (p->testRate) {
    e = (*v)(p->testRate, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference_SppQ_old(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference_SppQ_old *p = (struct __pyx_obj_6pyross_9inference_SppQ_old *)o;
  __pyx_tp_clear_6pyross_9inference_SIR_type(o);
  tmp = ((PyObject*)p->constant_terms);
  p->constant_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->linear_terms);
  p->linear_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->infection_terms);
  p->infection_terms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->test_pos);
  p->test_pos = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->test_freq);
  p->test_freq = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_parameters);
  p->model_parameters = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->det_model);
  p->det_model = ((struct __pyx_obj_6pyross_13deterministic_SppQ_old *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_spec);
  p->model_spec = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->param_dict);
  p->param_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->model_param_keys);
  p->model_param_keys = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->parameter_mapping);
  p->parameter_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->time_dep_param_mapping);
  p->time_dep_param_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->testRate);
  p->testRate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_constant_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_14constant_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_linear_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_12linear_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_infection_terms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_15infection_terms_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_test_pos(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_8test_pos_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_test_freq(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_9test_freq_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_nClassU(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_7nClassU_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_nClassUwoN(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_10nClassUwoN_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_model_parameters(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_16model_parameters_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_det_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_9det_model_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_model_spec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_10model_spec_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_param_dict(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_10param_dict_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_model_param_keys(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_16model_param_keys_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_parameter_mapping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_17parameter_mapping_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_time_dep_param_mapping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_22time_dep_param_mapping_1__get__(o);
}

static PyObject *__pyx_getprop_6pyross_9inference_8SppQ_old_testRate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pyross_9inference_8SppQ_old_8testRate_1__get__(o);
}

static PyMethodDef __pyx_methods_6pyross_9inference_SppQ_old[] = {
  {"infection_indices", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_3infection_indices, METH_NOARGS, 0},
  {"set_params", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_5set_params, METH_O, 0},
  {"set_time_dep_model_parameters", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_7set_time_dep_model_parameters, METH_O, 0},
  {"set_testRate", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_9set_testRate, METH_O, 0},
  {"set_det_model", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_11set_det_model, METH_O, 0},
  {"make_params_dict", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_13make_params_dict, METH_NOARGS, 0},
  {"_all_positive", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_15_all_positive, METH_O, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_17__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_8SppQ_old_19__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pyross_9inference_SppQ_old[] = {
  {(char *)"constant_terms", __pyx_getprop_6pyross_9inference_8SppQ_old_constant_terms, 0, (char *)0, 0},
  {(char *)"linear_terms", __pyx_getprop_6pyross_9inference_8SppQ_old_linear_terms, 0, (char *)0, 0},
  {(char *)"infection_terms", __pyx_getprop_6pyross_9inference_8SppQ_old_infection_terms, 0, (char *)0, 0},
  {(char *)"test_pos", __pyx_getprop_6pyross_9inference_8SppQ_old_test_pos, 0, (char *)0, 0},
  {(char *)"test_freq", __pyx_getprop_6pyross_9inference_8SppQ_old_test_freq, 0, (char *)0, 0},
  {(char *)"nClassU", __pyx_getprop_6pyross_9inference_8SppQ_old_nClassU, 0, (char *)0, 0},
  {(char *)"nClassUwoN", __pyx_getprop_6pyross_9inference_8SppQ_old_nClassUwoN, 0, (char *)0, 0},
  {(char *)"model_parameters", __pyx_getprop_6pyross_9inference_8SppQ_old_model_parameters, 0, (char *)0, 0},
  {(char *)"det_model", __pyx_getprop_6pyross_9inference_8SppQ_old_det_model, 0, (char *)0, 0},
  {(char *)"model_spec", __pyx_getprop_6pyross_9inference_8SppQ_old_model_spec, 0, (char *)0, 0},
  {(char *)"param_dict", __pyx_getprop_6pyross_9inference_8SppQ_old_param_dict, 0, (char *)0, 0},
  {(char *)"model_param_keys", __pyx_getprop_6pyross_9inference_8SppQ_old_model_param_keys, 0, (char *)0, 0},
  {(char *)"parameter_mapping", __pyx_getprop_6pyross_9inference_8SppQ_old_parameter_mapping, 0, (char *)0, 0},
  {(char *)"time_dep_param_mapping", __pyx_getprop_6pyross_9inference_8SppQ_old_time_dep_param_mapping, 0, (char *)0, 0},
  {(char *)"testRate", __pyx_getprop_6pyross_9inference_8SppQ_old_testRate, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SppQ_old = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SppQ_old", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SppQ_old), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_SppQ_old, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    No longer maintained, will be deprecated.\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_SppQ_old, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_SppQ_old, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SppQ_old, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pyross_9inference_SppQ_old, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_8SppQ_old_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SppQ_old, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_6pyross_9inference_SppSparse __pyx_vtable_6pyross_9inference_SppSparse;

static PyObject *__pyx_tp_new_6pyross_9inference_SppSparse(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pyross_9inference_SppSparse *p;
  PyObject *o = __pyx_tp_new_6pyross_9inference_Spp(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pyross_9inference_SppSparse *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pyross_9inference_SIR_type*)__pyx_vtabptr_6pyross_9inference_SppSparse;
  return o;
}

static PyMethodDef __pyx_methods_6pyross_9inference_SppSparse[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_9SppSparse_3__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pyross_9inference_9SppSparse_5__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pyross_9inference_SppSparse = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.SppSparse", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference_SppSparse), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference_Spp, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference_Spp, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference_Spp, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pyross_9inference_SppSparse, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pyross_9inference_9SppSparse_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference_SppSparse, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *__pyx_freelist_6pyross_9inference___pyx_scope_struct__FIM[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct__FIM = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct__FIM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct__FIM > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct__FIM[--__pyx_freecount_6pyross_9inference___pyx_scope_struct__FIM];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct__FIM(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_Tf);
  Py_CLEAR(p->__pyx_v_contactMatrix);
  Py_CLEAR(p->__pyx_v_generator);
  Py_CLEAR(p->__pyx_v_inter_steps);
  Py_CLEAR(p->__pyx_v_intervention_fun);
  Py_CLEAR(p->__pyx_v_kwargs);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_tangent);
  Py_CLEAR(p->__pyx_v_x0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct__FIM < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct__FIM[__pyx_freecount_6pyross_9inference___pyx_scope_struct__FIM++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct__FIM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *)o;
  if (p->__pyx_v_Tf) {
    e = (*v)(p->__pyx_v_Tf, a); if (e) return e;
  }
  if (p->__pyx_v_contactMatrix) {
    e = (*v)(p->__pyx_v_contactMatrix, a); if (e) return e;
  }
  if (p->__pyx_v_generator) {
    e = (*v)(p->__pyx_v_generator, a); if (e) return e;
  }
  if (p->__pyx_v_inter_steps) {
    e = (*v)(p->__pyx_v_inter_steps, a); if (e) return e;
  }
  if (p->__pyx_v_intervention_fun) {
    e = (*v)(p->__pyx_v_intervention_fun, a); if (e) return e;
  }
  if (p->__pyx_v_kwargs) {
    e = (*v)(p->__pyx_v_kwargs, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_tangent) {
    e = (*v)(p->__pyx_v_tangent, a); if (e) return e;
  }
  if (p->__pyx_v_x0) {
    e = (*v)(p->__pyx_v_x0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct__FIM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM *)o;
  tmp = ((PyObject*)p->__pyx_v_Tf);
  p->__pyx_v_Tf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_contactMatrix);
  p->__pyx_v_contactMatrix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_generator);
  p->__pyx_v_generator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_inter_steps);
  p->__pyx_v_inter_steps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_intervention_fun);
  p->__pyx_v_intervention_fun = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_kwargs);
  p->__pyx_v_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_tangent);
  p->__pyx_v_tangent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_x0);
  p->__pyx_v_x0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct__FIM = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct__FIM", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct__FIM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct__FIM, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct__FIM, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct__FIM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct__FIM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *__pyx_freelist_6pyross_9inference___pyx_scope_struct_1_FIM_det[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_1_FIM_det = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_1_FIM_det(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_1_FIM_det > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_1_FIM_det[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_1_FIM_det];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_1_FIM_det(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_Tf);
  Py_CLEAR(p->__pyx_v_contactMatrix);
  Py_CLEAR(p->__pyx_v_generator);
  Py_CLEAR(p->__pyx_v_inter_steps);
  Py_CLEAR(p->__pyx_v_intervention_fun);
  Py_CLEAR(p->__pyx_v_kwargs);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_x0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_1_FIM_det < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_1_FIM_det[__pyx_freecount_6pyross_9inference___pyx_scope_struct_1_FIM_det++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_1_FIM_det(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *)o;
  if (p->__pyx_v_Tf) {
    e = (*v)(p->__pyx_v_Tf, a); if (e) return e;
  }
  if (p->__pyx_v_contactMatrix) {
    e = (*v)(p->__pyx_v_contactMatrix, a); if (e) return e;
  }
  if (p->__pyx_v_generator) {
    e = (*v)(p->__pyx_v_generator, a); if (e) return e;
  }
  if (p->__pyx_v_inter_steps) {
    e = (*v)(p->__pyx_v_inter_steps, a); if (e) return e;
  }
  if (p->__pyx_v_intervention_fun) {
    e = (*v)(p->__pyx_v_intervention_fun, a); if (e) return e;
  }
  if (p->__pyx_v_kwargs) {
    e = (*v)(p->__pyx_v_kwargs, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_x0) {
    e = (*v)(p->__pyx_v_x0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_1_FIM_det(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det *)o;
  tmp = ((PyObject*)p->__pyx_v_Tf);
  p->__pyx_v_Tf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_contactMatrix);
  p->__pyx_v_contactMatrix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_generator);
  p->__pyx_v_generator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_inter_steps);
  p->__pyx_v_inter_steps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_intervention_fun);
  p->__pyx_v_intervention_fun = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_kwargs);
  p->__pyx_v_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_x0);
  p->__pyx_v_x0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_1_FIM_det", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_1_FIM_det), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_1_FIM_det, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_1_FIM_det, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_1_FIM_det, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_1_FIM_det, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *__pyx_freelist_6pyross_9inference___pyx_scope_struct_2_hessian[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_2_hessian = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_2_hessian(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_2_hessian > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_2_hessian[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_2_hessian];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_2_hessian(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_Tf);
  Py_CLEAR(p->__pyx_v_kwargs);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_tangent);
  Py_CLEAR(p->__pyx_v_x);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_2_hessian < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_2_hessian[__pyx_freecount_6pyross_9inference___pyx_scope_struct_2_hessian++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_2_hessian(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *)o;
  if (p->__pyx_v_Tf) {
    e = (*v)(p->__pyx_v_Tf, a); if (e) return e;
  }
  if (p->__pyx_v_kwargs) {
    e = (*v)(p->__pyx_v_kwargs, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_tangent) {
    e = (*v)(p->__pyx_v_tangent, a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_2_hessian(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian *)o;
  tmp = ((PyObject*)p->__pyx_v_Tf);
  p->__pyx_v_Tf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_kwargs);
  p->__pyx_v_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_tangent);
  p->__pyx_v_tangent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_x);
  p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_2_hessian", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_2_hessian), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_2_hessian, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_2_hessian, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_2_hessian, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_2_hessian, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *__pyx_freelist_6pyross_9inference___pyx_scope_struct_3_robustness[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_3_robustness = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_3_robustness(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_3_robustness > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_3_robustness[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_3_robustness];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_3_robustness(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_FIM);
  Py_CLEAR(p->__pyx_v_FIM_det);
  Py_CLEAR(p->__pyx_v_flat_maps);
  Py_CLEAR(p->__pyx_v_param_pos_1);
  Py_CLEAR(p->__pyx_v_param_pos_2);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_3_robustness < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_3_robustness[__pyx_freecount_6pyross_9inference___pyx_scope_struct_3_robustness++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_3_robustness(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *)o;
  if (p->__pyx_v_FIM) {
    e = (*v)(p->__pyx_v_FIM, a); if (e) return e;
  }
  if (p->__pyx_v_FIM_det) {
    e = (*v)(p->__pyx_v_FIM_det, a); if (e) return e;
  }
  if (p->__pyx_v_flat_maps) {
    e = (*v)(p->__pyx_v_flat_maps, a); if (e) return e;
  }
  if (p->__pyx_v_param_pos_1) {
    e = (*v)(p->__pyx_v_param_pos_1, a); if (e) return e;
  }
  if (p->__pyx_v_param_pos_2) {
    e = (*v)(p->__pyx_v_param_pos_2, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_3_robustness(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness *)o;
  tmp = ((PyObject*)p->__pyx_v_FIM);
  p->__pyx_v_FIM = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_FIM_det);
  p->__pyx_v_FIM_det = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_flat_maps);
  p->__pyx_v_flat_maps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_param_pos_1);
  p->__pyx_v_param_pos_1 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_param_pos_2);
  p->__pyx_v_param_pos_2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_3_robustness", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_3_robustness), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_3_robustness, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_3_robustness, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_3_robustness, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_3_robustness, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *__pyx_freelist_6pyross_9inference___pyx_scope_struct_4_latent_FIM[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_4_latent_FIM = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_4_latent_FIM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_4_latent_FIM > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_4_latent_FIM[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_4_latent_FIM];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_4_latent_FIM(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_Tf);
  Py_CLEAR(p->__pyx_v_contactMatrix);
  Py_CLEAR(p->__pyx_v_fltr);
  Py_CLEAR(p->__pyx_v_generator);
  Py_CLEAR(p->__pyx_v_inter_steps);
  Py_CLEAR(p->__pyx_v_intervention_fun);
  Py_CLEAR(p->__pyx_v_kwargs);
  Py_CLEAR(p->__pyx_v_obs);
  Py_CLEAR(p->__pyx_v_obs0);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_tangent);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_4_latent_FIM < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_4_latent_FIM[__pyx_freecount_6pyross_9inference___pyx_scope_struct_4_latent_FIM++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_4_latent_FIM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *)o;
  if (p->__pyx_v_Tf) {
    e = (*v)(p->__pyx_v_Tf, a); if (e) return e;
  }
  if (p->__pyx_v_contactMatrix) {
    e = (*v)(p->__pyx_v_contactMatrix, a); if (e) return e;
  }
  if (p->__pyx_v_fltr) {
    e = (*v)(p->__pyx_v_fltr, a); if (e) return e;
  }
  if (p->__pyx_v_generator) {
    e = (*v)(p->__pyx_v_generator, a); if (e) return e;
  }
  if (p->__pyx_v_inter_steps) {
    e = (*v)(p->__pyx_v_inter_steps, a); if (e) return e;
  }
  if (p->__pyx_v_intervention_fun) {
    e = (*v)(p->__pyx_v_intervention_fun, a); if (e) return e;
  }
  if (p->__pyx_v_kwargs) {
    e = (*v)(p->__pyx_v_kwargs, a); if (e) return e;
  }
  if (p->__pyx_v_obs) {
    e = (*v)(p->__pyx_v_obs, a); if (e) return e;
  }
  if (p->__pyx_v_obs0) {
    e = (*v)(p->__pyx_v_obs0, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_tangent) {
    e = (*v)(p->__pyx_v_tangent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_4_latent_FIM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM *)o;
  tmp = ((PyObject*)p->__pyx_v_Tf);
  p->__pyx_v_Tf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_contactMatrix);
  p->__pyx_v_contactMatrix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_fltr);
  p->__pyx_v_fltr = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_generator);
  p->__pyx_v_generator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_inter_steps);
  p->__pyx_v_inter_steps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_intervention_fun);
  p->__pyx_v_intervention_fun = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_kwargs);
  p->__pyx_v_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_obs);
  p->__pyx_v_obs = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_obs0);
  p->__pyx_v_obs0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_tangent);
  p->__pyx_v_tangent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_4_latent_FIM", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_4_latent_FIM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_4_latent_FIM, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_4_latent_FIM, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_4_latent_FIM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_4_latent_FIM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *__pyx_freelist_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_Tf);
  Py_CLEAR(p->__pyx_v_contactMatrix);
  Py_CLEAR(p->__pyx_v_fltr);
  Py_CLEAR(p->__pyx_v_generator);
  Py_CLEAR(p->__pyx_v_inter_steps);
  Py_CLEAR(p->__pyx_v_intervention_fun);
  Py_CLEAR(p->__pyx_v_kwargs);
  Py_CLEAR(p->__pyx_v_obs);
  Py_CLEAR(p->__pyx_v_obs0);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det[__pyx_freecount_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *)o;
  if (p->__pyx_v_Tf) {
    e = (*v)(p->__pyx_v_Tf, a); if (e) return e;
  }
  if (p->__pyx_v_contactMatrix) {
    e = (*v)(p->__pyx_v_contactMatrix, a); if (e) return e;
  }
  if (p->__pyx_v_fltr) {
    e = (*v)(p->__pyx_v_fltr, a); if (e) return e;
  }
  if (p->__pyx_v_generator) {
    e = (*v)(p->__pyx_v_generator, a); if (e) return e;
  }
  if (p->__pyx_v_inter_steps) {
    e = (*v)(p->__pyx_v_inter_steps, a); if (e) return e;
  }
  if (p->__pyx_v_intervention_fun) {
    e = (*v)(p->__pyx_v_intervention_fun, a); if (e) return e;
  }
  if (p->__pyx_v_kwargs) {
    e = (*v)(p->__pyx_v_kwargs, a); if (e) return e;
  }
  if (p->__pyx_v_obs) {
    e = (*v)(p->__pyx_v_obs, a); if (e) return e;
  }
  if (p->__pyx_v_obs0) {
    e = (*v)(p->__pyx_v_obs0, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det *)o;
  tmp = ((PyObject*)p->__pyx_v_Tf);
  p->__pyx_v_Tf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_contactMatrix);
  p->__pyx_v_contactMatrix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_fltr);
  p->__pyx_v_fltr = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_generator);
  p->__pyx_v_generator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_inter_steps);
  p->__pyx_v_inter_steps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_intervention_fun);
  p->__pyx_v_intervention_fun = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_kwargs);
  p->__pyx_v_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_obs);
  p->__pyx_v_obs = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_obs0);
  p->__pyx_v_obs0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_5_latent_FIM_det", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *__pyx_freelist_6pyross_9inference___pyx_scope_struct_6_latent_hessian[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_6_latent_hessian = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_6_latent_hessian(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_6_latent_hessian > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_6_latent_hessian[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_6_latent_hessian];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_6_latent_hessian(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_Tf);
  Py_CLEAR(p->__pyx_v_fltr);
  Py_CLEAR(p->__pyx_v_kwargs);
  Py_CLEAR(p->__pyx_v_obs);
  Py_CLEAR(p->__pyx_v_obs0);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_tangent);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_6_latent_hessian < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_6_latent_hessian[__pyx_freecount_6pyross_9inference___pyx_scope_struct_6_latent_hessian++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_6_latent_hessian(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *)o;
  if (p->__pyx_v_Tf) {
    e = (*v)(p->__pyx_v_Tf, a); if (e) return e;
  }
  if (p->__pyx_v_fltr) {
    e = (*v)(p->__pyx_v_fltr, a); if (e) return e;
  }
  if (p->__pyx_v_kwargs) {
    e = (*v)(p->__pyx_v_kwargs, a); if (e) return e;
  }
  if (p->__pyx_v_obs) {
    e = (*v)(p->__pyx_v_obs, a); if (e) return e;
  }
  if (p->__pyx_v_obs0) {
    e = (*v)(p->__pyx_v_obs0, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_tangent) {
    e = (*v)(p->__pyx_v_tangent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_6_latent_hessian(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian *)o;
  tmp = ((PyObject*)p->__pyx_v_Tf);
  p->__pyx_v_Tf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_fltr);
  p->__pyx_v_fltr = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_kwargs);
  p->__pyx_v_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_obs);
  p->__pyx_v_obs = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_obs0);
  p->__pyx_v_obs0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_tangent);
  p->__pyx_v_tangent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_6_latent_hessian", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_6_latent_hessian), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_6_latent_hessian, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_6_latent_hessian, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_6_latent_hessian, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_6_latent_hessian, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *__pyx_freelist_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_sol);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov[__pyx_freecount_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_sol) {
    e = (*v)(p->__pyx_v_sol, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_sol);
  p->__pyx_v_sol = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_7__estimate_cond_cov", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *__pyx_freelist_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_sol);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op[__pyx_freecount_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_sol) {
    e = (*v)(p->__pyx_v_sol, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_sol);
  p->__pyx_v_sol = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_8__obtain_time_evol_op", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *__pyx_freelist_6pyross_9inference___pyx_scope_struct_9_integrate[8];
static int __pyx_freecount_6pyross_9inference___pyx_scope_struct_9_integrate = 0;

static PyObject *__pyx_tp_new_6pyross_9inference___pyx_scope_struct_9_integrate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pyross_9inference___pyx_scope_struct_9_integrate > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate)))) {
    o = (PyObject*)__pyx_freelist_6pyross_9inference___pyx_scope_struct_9_integrate[--__pyx_freecount_6pyross_9inference___pyx_scope_struct_9_integrate];
    memset(o, 0, sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_9_integrate(PyObject *o) {
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pyross_9inference___pyx_scope_struct_9_integrate < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate)))) {
    __pyx_freelist_6pyross_9inference___pyx_scope_struct_9_integrate[__pyx_freecount_6pyross_9inference___pyx_scope_struct_9_integrate++] = ((struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_9_integrate(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_9_integrate(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *p = (struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6pyross_9inference_SIR_type *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.__pyx_scope_struct_9_integrate", /*tp_name*/
  sizeof(struct __pyx_obj_6pyross_9inference___pyx_scope_struct_9_integrate), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pyross_9inference___pyx_scope_struct_9_integrate, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pyross_9inference___pyx_scope_struct_9_integrate, /*tp_traverse*/
  __pyx_tp_clear_6pyross_9inference___pyx_scope_struct_9_integrate, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pyross_9inference___pyx_scope_struct_9_integrate, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  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))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_array___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_array = {
  __pyx_array___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  __pyx_array___len__, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  PyObject* tmp;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_Enum[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_memoryview___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  Py_CLEAR(p->_array_interface);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->_array_interface) {
    e = (*v)(p->_array_interface, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  tmp = ((PyObject*)p->obj);
  p->obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_size);
  p->_size = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_array_interface);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  Py_CLEAR(p->view.obj);
  return 0;
}
static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference.memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_memoryviewslice___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  tmp = ((PyObject*)p->from_object);
  p->from_object = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyross.inference._memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Internal class for passing memoryview slices to Python", /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets__memoryviewslice, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) {
  static const char* internal_type_names[] = {
    "BOOL_t",
    "DTYPE_t",
    "Enum",
    "FILE",
    "PyObject",
    "PyThread_type_lock",
    "Py_intptr_t",
    "SEAIRQ",
    "SEAIRQ_testing",
    "SEIR",
    "SIR",
    "SIR_type",
    "Spp",
    "SppQ",
    "SppQ_old",
    "SppSparse",
    "__Pyx_TypeInfo",
    "__Pyx_memviewslice",
    "__pyx_atomic_int",
    "__pyx_buffer",
    "__pyx_ctuple_34737__d5674____dunderpyx_ctuple_Py_ssize_t__dunderand_Py_ssize_t__dunderand_Py_ssize_t__dunderand_Py_ssize_t__etc__etc",
    "__pyx_ctuple_34737__d5674____dunderpyx_ctuple_Py_ssize_t__dunderand_Py_ssize_t__dunderand_Py_ssize_t__dunderand_Py_ssize_t__etc__etc_struct",
    "__pyx_ctuple_Py_ssize_t",
    "__pyx_ctuple_Py_ssize_t__and_Py_ssize_t",
    "__pyx_ctuple_Py_ssize_t__and_Py_ssize_t__and_Py_ssize_t__and_Py_ssize_t",
    "__pyx_ctuple_Py_ssize_t__and_Py_ssize_t__and_Py_ssize_t__and_Py_ssize_t_struct",
    "__pyx_ctuple_Py_ssize_t__and_Py_ssize_t_struct",
    "__pyx_ctuple_Py_ssize_t__and_long",
    "__pyx_ctuple_Py_ssize_t__and_long_struct",
    "__pyx_ctuple_Py_ssize_t_struct",
    "__pyx_ctuple___dunderpyx_ctuple_Py_ssize_t__dunderand_Py_ssize_t",
    "__pyx_ctuple___dunderpyx_ctuple_Py_ssize_t__dunderand_Py_ssize_t_struct",
    "__pyx_ctuple_char__ptr",
    "__pyx_ctuple_char__ptr_struct",
    "__pyx_ctuple_double",
    "__pyx_ctuple_double__and_double",
    "__pyx_ctuple_double__and_double__and_Py_ssize_t",
    "__pyx_ctuple_double__and_double__and_Py_ssize_t_struct",
    "__pyx_ctuple_double__and_double_struct",
    "__pyx_ctuple_double_struct",
    "__pyx_ctuple_int",
    "__pyx_ctuple_int__and_Py_ssize_t",
    "__pyx_ctuple_int__and_Py_ssize_t__and_Py_ssize_t",
    "__pyx_ctuple_int__and_Py_ssize_t__and_Py_ssize_t_struct",
    "__pyx_ctuple_int__and_Py_ssize_t_struct",
    "__pyx_ctuple_int_struct",
    "__pyx_ctuple_long",
    "__pyx_ctuple_long__and_Py_ssize_t",
    "__pyx_ctuple_long__and_Py_ssize_t__and_Py_ssize_t",
    "__pyx_ctuple_long__and_Py_ssize_t__and_Py_ssize_t_struct",
    "__pyx_ctuple_long__and_Py_ssize_t_struct",
    "__pyx_ctuple_long__and_double__and_Py_ssize_t",
    "__pyx_ctuple_long__and_double__and_Py_ssize_t_struct",
    "__pyx_ctuple_long__and_long__and_long",
    "__pyx_ctuple_long__and_long__and_long__and_long",
    "__pyx_ctuple_long__and_long__and_long__and_long_struct",
    "__pyx_ctuple_long__and_long__and_long_struct",
    "__pyx_ctuple_long_struct",
    "__pyx_ctuple_npy_intp",
    "__pyx_ctuple_npy_intp_struct",
    "__pyx_memoryview",
    "__pyx_opt_args_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix",
    "__pyx_opt_args_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix",
    "__pyx_opt_args_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix",
    "__pyx_opt_args_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix",
    "__pyx_opt_args_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix",
    "__pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj",
    "__pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj",
    "__pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix",
    "__pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov",
    "__pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space",
    "__pyx_opt_args_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix",
    "__pyx_scope_struct_1_FIM_det",
    "__pyx_scope_struct_2_hessian",
    "__pyx_scope_struct_3_robustness",
    "__pyx_scope_struct_4_latent_FIM",
    "__pyx_scope_struct_5_latent_FIM_det",
    "__pyx_scope_struct_6_latent_hessian",
    "__pyx_scope_struct_7__estimate_cond_cov",
    "__pyx_scope_struct_8__obtain_time_evol_op",
    "__pyx_scope_struct_9_integrate",
    "__pyx_scope_struct__FIM",
    "_memoryviewslice",
    "array",
    "memoryview",
    0
  };
  const char** type_name = internal_type_names;
  while (*type_name) {
    if (__Pyx_StrEq(name, *type_name)) {
      PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
      goto bad;
    }
    type_name++;
  }
  if (0);
  else if (__Pyx_StrEq(name, "PI")) {
    __pyx_v_6pyross_9inference_PI = __pyx_PyFloat_AsDouble(o); if (unlikely((__pyx_v_6pyross_9inference_PI == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "Py_None")) {
    PyErr_Format(PyExc_TypeError, "Cannot convert Python object Py_None to PyObject *");
    __PYX_ERR(1, 57, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "__pyx_memoryview_thread_locks")) {
    PyErr_Format(PyExc_TypeError, "Cannot convert Python object __pyx_memoryview_thread_locks to PyThread_type_lock [8]");
    __PYX_ERR(1, 317, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "__pyx_memoryview_thread_locks_used")) {
    __pyx_memoryview_thread_locks_used = __Pyx_PyInt_As_int(o); if (unlikely((__pyx_memoryview_thread_locks_used == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 316, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "contiguous")) {
    Py_INCREF(o);
    Py_DECREF(contiguous);
    contiguous = o;
  }
  else if (__Pyx_StrEq(name, "generic")) {
    Py_INCREF(o);
    Py_DECREF(generic);
    generic = o;
  }
  else if (__Pyx_StrEq(name, "indirect")) {
    Py_INCREF(o);
    Py_DECREF(indirect);
    indirect = o;
  }
  else if (__Pyx_StrEq(name, "indirect_contiguous")) {
    Py_INCREF(o);
    Py_DECREF(indirect_contiguous);
    indirect_contiguous = o;
  }
  else if (__Pyx_StrEq(name, "strided")) {
    Py_INCREF(o);
    Py_DECREF(strided);
    strided = o;
  }
  else {
    if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
  }
  return 0;
  __pyx_L2_error:;
  __Pyx_AddTraceback("pyross.inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  bad:
  return -1;
}

static int
__Pyx_import_all_from(PyObject *locals, PyObject *v)
{
    PyObject *all = PyObject_GetAttrString(v, "__all__");
    PyObject *dict, *name, *value;
    int skip_leading_underscores = 0;
    int pos, err;
    if (all == NULL) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            return -1;
        PyErr_Clear();
        dict = PyObject_GetAttrString(v, "__dict__");
        if (dict == NULL) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError))
                return -1;
            PyErr_SetString(PyExc_ImportError,
            "from-import-* object has no __dict__ and no __all__");
            return -1;
        }
#if PY_MAJOR_VERSION < 3
        all = PyObject_CallMethod(dict, (char *)"keys", NULL);
#else
        all = PyMapping_Keys(dict);
#endif
        Py_DECREF(dict);
        if (all == NULL)
            return -1;
        skip_leading_underscores = 1;
    }
    for (pos = 0, err = 0; ; pos++) {
        name = PySequence_GetItem(all, pos);
        if (name == NULL) {
            if (!PyErr_ExceptionMatches(PyExc_IndexError))
                err = -1;
            else
                PyErr_Clear();
            break;
        }
        if (skip_leading_underscores &&
#if PY_MAJOR_VERSION < 3
            PyString_Check(name) &&
            PyString_AS_STRING(name)[0] == '_')
#else
            PyUnicode_Check(name) &&
            PyUnicode_AS_UNICODE(name)[0] == '_')
#endif
        {
            Py_DECREF(name);
            continue;
        }
        value = PyObject_GetAttr(v, name);
        if (value == NULL)
            err = -1;
        else if (PyDict_CheckExact(locals))
            err = PyDict_SetItem(locals, name, value);
        else
            err = PyObject_SetItem(locals, name, value);
        Py_DECREF(name);
        Py_XDECREF(value);
        if (err != 0)
            break;
    }
    Py_DECREF(all);
    return err;
}
static int __pyx_import_star(PyObject* m) {
    int i;
    int ret = -1;
    char* s;
    PyObject *locals = 0;
    PyObject *list = 0;
#if PY_MAJOR_VERSION >= 3
    PyObject *utf8_name = 0;
#endif
    PyObject *name;
    PyObject *item;
    locals = PyDict_New();              if (!locals) goto bad;
    if (__Pyx_import_all_from(locals, m) < 0) goto bad;
    list = PyDict_Items(locals);        if (!list) goto bad;
    for(i=0; i<PyList_GET_SIZE(list); i++) {
        name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);
        item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);
#if PY_MAJOR_VERSION >= 3
        utf8_name = PyUnicode_AsUTF8String(name);
        if (!utf8_name) goto bad;
        s = PyBytes_AS_STRING(utf8_name);
        if (__pyx_import_star_set(item, name, s) < 0) goto bad;
        Py_DECREF(utf8_name); utf8_name = 0;
#else
        s = PyString_AsString(name);
        if (!s) goto bad;
        if (__pyx_import_star_set(item, name, s) < 0) goto bad;
#endif
    }
    ret = 0;
bad:
    Py_XDECREF(locals);
    Py_XDECREF(list);
#if PY_MAJOR_VERSION >= 3
    Py_XDECREF(utf8_name);
#endif
    return ret;
}



#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_inference(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_inference},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "inference",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_u_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 1, 0, 1},
  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  {&__pyx_n_s_Array, __pyx_k_Array, sizeof(__pyx_k_Array), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__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},
  {&__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},
  {&__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},
  {&__pyx_kp_u_Compute_the_maximum_a_posterior, __pyx_k_Compute_the_maximum_a_posterior, sizeof(__pyx_k_Compute_the_maximum_a_posterior), 0, 1, 0, 0},
  {&__pyx_kp_u_Compute_the_maximum_a_posterior_2, __pyx_k_Compute_the_maximum_a_posterior_2, sizeof(__pyx_k_Compute_the_maximum_a_posterior_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Conflicts_in_initial_conditions, __pyx_k_Conflicts_in_initial_conditions, sizeof(__pyx_k_Conflicts_in_initial_conditions), 0, 1, 0, 0},
  {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1},
  {&__pyx_n_u_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 1, 0, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_EnsembleSampler, __pyx_k_EnsembleSampler, sizeof(__pyx_k_EnsembleSampler), 0, 0, 1, 1},
  {&__pyx_kp_u_Error_lyapunov_method_not_found, __pyx_k_Error_lyapunov_method_not_found, sizeof(__pyx_k_Error_lyapunov_method_not_found), 0, 1, 0, 0},
  {&__pyx_n_s_FIM, __pyx_k_FIM, sizeof(__pyx_k_FIM), 0, 0, 1, 1},
  {&__pyx_n_s_FIM_det, __pyx_k_FIM_det, sizeof(__pyx_k_FIM_det), 0, 0, 1, 1},
  {&__pyx_n_s_FIM_det_locals_mean, __pyx_k_FIM_det_locals_mean, sizeof(__pyx_k_FIM_det_locals_mean), 0, 0, 1, 1},
  {&__pyx_n_s_FIM_locals_covariance, __pyx_k_FIM_locals_covariance, sizeof(__pyx_k_FIM_locals_covariance), 0, 0, 1, 1},
  {&__pyx_n_s_FIM_locals_mean, __pyx_k_FIM_locals_mean, sizeof(__pyx_k_FIM_locals_mean), 0, 0, 1, 1},
  {&__pyx_kp_u_FIM_not_positive_definite_check, __pyx_k_FIM_not_positive_definite_check, sizeof(__pyx_k_FIM_not_positive_definite_check), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  {&__pyx_n_u_Ia, __pyx_k_Ia, sizeof(__pyx_k_Ia), 0, 1, 0, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x06, __pyx_k_Incompatible_checksums_s_vs_0x06, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x06), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x16, __pyx_k_Incompatible_checksums_s_vs_0x16, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x16), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x16_2, __pyx_k_Incompatible_checksums_s_vs_0x16_2, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x16_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x29, __pyx_k_Incompatible_checksums_s_vs_0x29, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x29), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x5c, __pyx_k_Incompatible_checksums_s_vs_0x5c, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x5c), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xa4, __pyx_k_Incompatible_checksums_s_vs_0xa4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xa4), 0, 0, 1, 0},
  {&__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},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xdc, __pyx_k_Incompatible_checksums_s_vs_0xdc, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xdc), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xe4, __pyx_k_Incompatible_checksums_s_vs_0xe4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xe4), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  {&__pyx_n_s_Inf, __pyx_k_Inf, sizeof(__pyx_k_Inf), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_Inverse, __pyx_k_Inverse, sizeof(__pyx_k_Inverse), 0, 0, 1, 1},
  {&__pyx_n_u_Is, __pyx_k_Is, sizeof(__pyx_k_Is), 0, 1, 0, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_kp_u_Key_error_or_unspecified_generat, __pyx_k_Key_error_or_unspecified_generat, sizeof(__pyx_k_Key_error_or_unspecified_generat), 0, 1, 0, 0},
  {&__pyx_n_u_LSODA, __pyx_k_LSODA, sizeof(__pyx_k_LSODA), 0, 1, 0, 1},
  {&__pyx_n_s_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 0, 1, 1},
  {&__pyx_n_s_M0, __pyx_k_M0, sizeof(__pyx_k_M0), 0, 0, 1, 1},
  {&__pyx_kp_u_MCMC_sampling_needs_optional_dep, __pyx_k_MCMC_sampling_needs_optional_dep, sizeof(__pyx_k_MCMC_sampling_needs_optional_dep), 0, 1, 0, 0},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__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},
  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  {&__pyx_n_s_MutableDenseNDimArray, __pyx_k_MutableDenseNDimArray, sizeof(__pyx_k_MutableDenseNDimArray), 0, 0, 1, 1},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_s_NestedSampler, __pyx_k_NestedSampler, sizeof(__pyx_k_NestedSampler), 0, 0, 1, 1},
  {&__pyx_kp_u_Nested_sampling_needs_optional_d, __pyx_k_Nested_sampling_needs_optional_d, sizeof(__pyx_k_Nested_sampling_needs_optional_d), 0, 1, 0, 0},
  {&__pyx_n_s_Nf, __pyx_k_Nf, sizeof(__pyx_k_Nf), 0, 0, 1, 1},
  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_kp_u_Number_of_steps_must_be_at_least, __pyx_k_Number_of_steps_must_be_at_least, sizeof(__pyx_k_Number_of_steps_must_be_at_least), 0, 1, 0, 0},
  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  {&__pyx_n_s_Omega, __pyx_k_Omega, sizeof(__pyx_k_Omega), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_kp_u_Please_Implement_compute_jacobia, __pyx_k_Please_Implement_compute_jacobia, sizeof(__pyx_k_Please_Implement_compute_jacobia), 0, 1, 0, 0},
  {&__pyx_kp_u_Please_Implement_make_params_dic, __pyx_k_Please_Implement_make_params_dic, sizeof(__pyx_k_Please_Implement_make_params_dic), 0, 1, 0, 0},
  {&__pyx_kp_u_Please_Implement_set_det_model_i, __pyx_k_Please_Implement_set_det_model_i, sizeof(__pyx_k_Please_Implement_set_det_model_i), 0, 1, 0, 0},
  {&__pyx_n_s_Prior, __pyx_k_Prior, sizeof(__pyx_k_Prior), 0, 0, 1, 1},
  {&__pyx_n_s_ProcessingPool, __pyx_k_ProcessingPool, sizeof(__pyx_k_ProcessingPool), 0, 0, 1, 1},
  {&__pyx_n_u_Q, __pyx_k_Q, sizeof(__pyx_k_Q), 0, 1, 0, 1},
  {&__pyx_n_u_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 1, 0, 1},
  {&__pyx_n_u_RK2, __pyx_k_RK2, sizeof(__pyx_k_RK2), 0, 1, 0, 1},
  {&__pyx_n_s_RK2_integration, __pyx_k_RK2_integration, sizeof(__pyx_k_RK2_integration), 0, 0, 1, 1},
  {&__pyx_n_u_RK45, __pyx_k_RK45, sizeof(__pyx_k_RK45), 0, 1, 0, 1},
  {&__pyx_kp_u_Robustness_analysis_in_a_two_di, __pyx_k_Robustness_analysis_in_a_two_di, sizeof(__pyx_k_Robustness_analysis_in_a_two_di), 0, 1, 0, 0},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_u_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 1, 0, 1},
  {&__pyx_n_s_SEAIRQ, __pyx_k_SEAIRQ, sizeof(__pyx_k_SEAIRQ), 0, 0, 1, 1},
  {&__pyx_n_s_SEAIRQ_testing, __pyx_k_SEAIRQ_testing, sizeof(__pyx_k_SEAIRQ_testing), 0, 0, 1, 1},
  {&__pyx_n_s_SEIR, __pyx_k_SEIR, sizeof(__pyx_k_SEIR), 0, 0, 1, 1},
  {&__pyx_n_s_SIR, __pyx_k_SIR, sizeof(__pyx_k_SIR), 0, 0, 1, 1},
  {&__pyx_n_s_SIR_type, __pyx_k_SIR_type, sizeof(__pyx_k_SIR_type), 0, 0, 1, 1},
  {&__pyx_n_s_SIR_type__estimate_cond_cov_loca, __pyx_k_SIR_type__estimate_cond_cov_loca, sizeof(__pyx_k_SIR_type__estimate_cond_cov_loca), 0, 0, 1, 1},
  {&__pyx_kp_u_SIR_type_infer_line_304, __pyx_k_SIR_type_infer_line_304, sizeof(__pyx_k_SIR_type_infer_line_304), 0, 1, 0, 0},
  {&__pyx_kp_u_SIR_type_infer_mcmc_line_649, __pyx_k_SIR_type_infer_mcmc_line_649, sizeof(__pyx_k_SIR_type_infer_mcmc_line_649), 0, 1, 0, 0},
  {&__pyx_kp_u_SIR_type_latent_infer_line_1712, __pyx_k_SIR_type_latent_infer_line_1712, sizeof(__pyx_k_SIR_type_latent_infer_line_1712), 0, 1, 0, 0},
  {&__pyx_kp_u_SIR_type_latent_infer_mcmc_line, __pyx_k_SIR_type_latent_infer_mcmc_line, sizeof(__pyx_k_SIR_type_latent_infer_mcmc_line), 0, 1, 0, 0},
  {&__pyx_kp_u_SIR_type_robustness_line_1216, __pyx_k_SIR_type_robustness_line_1216, sizeof(__pyx_k_SIR_type_robustness_line_1216), 0, 1, 0, 0},
  {&__pyx_kp_u_Sample_the_posterior_distributi, __pyx_k_Sample_the_posterior_distributi, sizeof(__pyx_k_Sample_the_posterior_distributi), 0, 1, 0, 0},
  {&__pyx_kp_u_Sample_the_posterior_distributi_2, __pyx_k_Sample_the_posterior_distributi_2, sizeof(__pyx_k_Sample_the_posterior_distributi_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Specify_a_generator, __pyx_k_Specify_a_generator, sizeof(__pyx_k_Specify_a_generator), 0, 1, 0, 0},
  {&__pyx_kp_u_Specify_either_a_fixed_contactMa, __pyx_k_Specify_either_a_fixed_contactMa, sizeof(__pyx_k_Specify_either_a_fixed_contactMa), 0, 1, 0, 0},
  {&__pyx_kp_u_Specify_either_parameter_mapping, __pyx_k_Specify_either_parameter_mapping, sizeof(__pyx_k_Specify_either_parameter_mapping), 0, 1, 0, 0},
  {&__pyx_n_s_Spp, __pyx_k_Spp, sizeof(__pyx_k_Spp), 0, 0, 1, 1},
  {&__pyx_n_s_SppQ, __pyx_k_SppQ, sizeof(__pyx_k_SppQ), 0, 0, 1, 1},
  {&__pyx_n_s_SppQ_old, __pyx_k_SppQ_old, sizeof(__pyx_k_SppQ_old), 0, 0, 1, 1},
  {&__pyx_n_s_SppSparse, __pyx_k_SppSparse, sizeof(__pyx_k_SppSparse), 0, 0, 1, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_n_s_Tf, __pyx_k_Tf, sizeof(__pyx_k_Tf), 0, 0, 1, 1},
  {&__pyx_n_u_Tf, __pyx_k_Tf, sizeof(__pyx_k_Tf), 0, 1, 0, 1},
  {&__pyx_kp_u_The_Python_package_pathos_is_nee, __pyx_k_The_Python_package_pathos_is_nee, sizeof(__pyx_k_The_Python_package_pathos_is_nee), 0, 1, 0, 0},
  {&__pyx_kp_u_The_parameters_passed_do_not_con, __pyx_k_The_parameters_passed_do_not_con, sizeof(__pyx_k_The_parameters_passed_do_not_con), 0, 1, 0, 0},
  {&__pyx_kp_u_The_parameters_passed_do_not_con_2, __pyx_k_The_parameters_passed_do_not_con_2, sizeof(__pyx_k_The_parameters_passed_do_not_con_2), 0, 1, 0, 0},
  {&__pyx_kp_u_The_parameters_returned_by_param, __pyx_k_The_parameters_returned_by_param, sizeof(__pyx_k_The_parameters_returned_by_param), 0, 1, 0, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_U_mat, __pyx_k_U_mat, sizeof(__pyx_k_U_mat), 0, 0, 1, 1},
  {&__pyx_n_s_U_vec, __pyx_k_U_vec, sizeof(__pyx_k_U_vec), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  {&__pyx_n_s__75, __pyx_k__75, sizeof(__pyx_k__75), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_add_live, __pyx_k_add_live, sizeof(__pyx_k_add_live), 0, 0, 1, 1},
  {&__pyx_n_s_age_dep_rates, __pyx_k_age_dep_rates, sizeof(__pyx_k_age_dep_rates), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_all_positive, __pyx_k_all_positive, sizeof(__pyx_k_all_positive), 0, 0, 1, 1},
  {&__pyx_n_s_allclose, __pyx_k_allclose, sizeof(__pyx_k_allclose), 0, 0, 1, 1},
  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  {&__pyx_n_u_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 1, 0, 1},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_approx_fprime, __pyx_k_approx_fprime, sizeof(__pyx_k_approx_fprime), 0, 0, 1, 1},
  {&__pyx_n_s_args_dict, __pyx_k_args_dict, sizeof(__pyx_k_args_dict), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_u_ars, __pyx_k_ars, sizeof(__pyx_k_ars), 0, 1, 0, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_u_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 1, 0, 1},
  {&__pyx_n_s_bilinear, __pyx_k_bilinear, sizeof(__pyx_k_bilinear), 0, 0, 1, 1},
  {&__pyx_n_s_block_diag, __pyx_k_block_diag, sizeof(__pyx_k_block_diag), 0, 0, 1, 1},
  {&__pyx_n_u_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 0, 1},
  {&__pyx_n_s_bounds, __pyx_k_bounds, sizeof(__pyx_k_bounds), 0, 0, 1, 1},
  {&__pyx_n_u_bounds, __pyx_k_bounds, sizeof(__pyx_k_bounds), 0, 1, 0, 1},
  {&__pyx_n_s_build_SppQ_model_spec, __pyx_k_build_SppQ_model_spec, sizeof(__pyx_k_build_SppQ_model_spec), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  {&__pyx_n_u_central, __pyx_k_central, sizeof(__pyx_k_central), 0, 1, 0, 1},
  {&__pyx_n_s_check_length, __pyx_k_check_length, sizeof(__pyx_k_check_length), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_cma_population, __pyx_k_cma_population, sizeof(__pyx_k_cma_population), 0, 0, 1, 1},
  {&__pyx_n_s_cma_processes, __pyx_k_cma_processes, sizeof(__pyx_k_cma_processes), 0, 0, 1, 1},
  {&__pyx_n_s_cma_random_seed, __pyx_k_cma_random_seed, sizeof(__pyx_k_cma_random_seed), 0, 0, 1, 1},
  {&__pyx_n_s_cma_stds, __pyx_k_cma_stds, sizeof(__pyx_k_cma_stds), 0, 0, 1, 1},
  {&__pyx_n_s_compress, __pyx_k_compress, sizeof(__pyx_k_compress), 0, 0, 1, 1},
  {&__pyx_n_s_concatenate, __pyx_k_concatenate, sizeof(__pyx_k_concatenate), 0, 0, 1, 1},
  {&__pyx_n_s_constant_contactMatrix, __pyx_k_constant_contactMatrix, sizeof(__pyx_k_constant_contactMatrix), 0, 0, 1, 1},
  {&__pyx_n_s_construct_inits, __pyx_k_construct_inits, sizeof(__pyx_k_construct_inits), 0, 0, 1, 1},
  {&__pyx_n_s_contactMatrix, __pyx_k_contactMatrix, sizeof(__pyx_k_contactMatrix), 0, 0, 1, 1},
  {&__pyx_n_s_contact_matrix0, __pyx_k_contact_matrix0, sizeof(__pyx_k_contact_matrix0), 0, 0, 1, 1},
  {&__pyx_n_s_contact_matrix_threshold, __pyx_k_contact_matrix_threshold, sizeof(__pyx_k_contact_matrix_threshold), 0, 0, 1, 1},
  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  {&__pyx_n_u_control_params_dict, __pyx_k_control_params_dict, sizeof(__pyx_k_control_params_dict), 0, 1, 0, 1},
  {&__pyx_n_s_convert_vec_to_mat, __pyx_k_convert_vec_to_mat, sizeof(__pyx_k_convert_vec_to_mat), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_cov, __pyx_k_cov, sizeof(__pyx_k_cov), 0, 0, 1, 1},
  {&__pyx_n_s_cov_2, __pyx_k_cov_2, sizeof(__pyx_k_cov_2), 0, 0, 1, 1},
  {&__pyx_n_s_covariance, __pyx_k_covariance, sizeof(__pyx_k_covariance), 0, 0, 1, 1},
  {&__pyx_n_s_cpu_count, __pyx_k_cpu_count, sizeof(__pyx_k_cpu_count), 0, 0, 1, 1},
  {&__pyx_n_s_dUdt, __pyx_k_dUdt, sizeof(__pyx_k_dUdt), 0, 0, 1, 1},
  {&__pyx_n_s_dense_output, __pyx_k_dense_output, sizeof(__pyx_k_dense_output), 0, 0, 1, 1},
  {&__pyx_n_s_det, __pyx_k_det, sizeof(__pyx_k_det), 0, 0, 1, 1},
  {&__pyx_n_s_det_method, __pyx_k_det_method, sizeof(__pyx_k_det_method), 0, 0, 1, 1},
  {&__pyx_n_s_det_model, __pyx_k_det_model, sizeof(__pyx_k_det_model), 0, 0, 1, 1},
  {&__pyx_n_s_dev, __pyx_k_dev, sizeof(__pyx_k_dev), 0, 0, 1, 1},
  {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1},
  {&__pyx_n_s_diagonal, __pyx_k_diagonal, sizeof(__pyx_k_diagonal), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_dill, __pyx_k_dill, sizeof(__pyx_k_dill), 0, 0, 1, 1},
  {&__pyx_n_u_disable_penalty, __pyx_k_disable_penalty, sizeof(__pyx_k_disable_penalty), 0, 1, 0, 1},
  {&__pyx_n_s_discard, __pyx_k_discard, sizeof(__pyx_k_discard), 0, 0, 1, 1},
  {&__pyx_n_s_divide, __pyx_k_divide, sizeof(__pyx_k_divide), 0, 0, 1, 1},
  {&__pyx_n_s_dlogz, __pyx_k_dlogz, sizeof(__pyx_k_dlogz), 0, 0, 1, 1},
  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_dxdt, __pyx_k_dxdt, sizeof(__pyx_k_dxdt), 0, 0, 1, 1},
  {&__pyx_n_s_dynesty, __pyx_k_dynesty, sizeof(__pyx_k_dynesty), 0, 0, 1, 1},
  {&__pyx_n_s_eig, __pyx_k_eig, sizeof(__pyx_k_eig), 0, 0, 1, 1},
  {&__pyx_n_s_eigvalsh, __pyx_k_eigvalsh, sizeof(__pyx_k_eigvalsh), 0, 0, 1, 1},
  {&__pyx_n_s_emcee, __pyx_k_emcee, sizeof(__pyx_k_emcee), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_enable_global, __pyx_k_enable_global, sizeof(__pyx_k_enable_global), 0, 0, 1, 1},
  {&__pyx_n_s_enable_local, __pyx_k_enable_local, sizeof(__pyx_k_enable_local), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 0, 0, 1, 1},
  {&__pyx_kp_u_eps_vector_used_for_differentiat, __pyx_k_eps_vector_used_for_differentiat, sizeof(__pyx_k_eps_vector_used_for_differentiat), 0, 1, 0, 0},
  {&__pyx_kp_u_epsilon_used_for_differentiation, __pyx_k_epsilon_used_for_differentiation, sizeof(__pyx_k_epsilon_used_for_differentiation), 0, 1, 0, 0},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_u_euler, __pyx_k_euler, sizeof(__pyx_k_euler), 0, 1, 0, 1},
  {&__pyx_n_s_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 0, 0, 1, 1},
  {&__pyx_n_s_eye, __pyx_k_eye, sizeof(__pyx_k_eye), 0, 0, 1, 1},
  {&__pyx_n_s_fd_method, __pyx_k_fd_method, sizeof(__pyx_k_fd_method), 0, 0, 1, 1},
  {&__pyx_n_s_fi, __pyx_k_fi, sizeof(__pyx_k_fi), 0, 0, 1, 1},
  {&__pyx_n_s_fill_params_dict, __pyx_k_fill_params_dict, sizeof(__pyx_k_fill_params_dict), 0, 0, 1, 1},
  {&__pyx_n_s_find_fastest_growing_lin_mode, __pyx_k_find_fastest_growing_lin_mode, sizeof(__pyx_k_find_fastest_growing_lin_mode), 0, 0, 1, 1},
  {&__pyx_n_s_first_step, __pyx_k_first_step, sizeof(__pyx_k_first_step), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
  {&__pyx_n_s_flat_guess_range, __pyx_k_flat_guess_range, sizeof(__pyx_k_flat_guess_range), 0, 0, 1, 1},
  {&__pyx_n_u_flat_guess_range, __pyx_k_flat_guess_range, sizeof(__pyx_k_flat_guess_range), 0, 1, 0, 1},
  {&__pyx_n_u_flat_map, __pyx_k_flat_map, sizeof(__pyx_k_flat_map), 0, 1, 0, 1},
  {&__pyx_n_u_flat_params, __pyx_k_flat_params, sizeof(__pyx_k_flat_params), 0, 1, 0, 1},
  {&__pyx_n_s_flatten, __pyx_k_flatten, sizeof(__pyx_k_flatten), 0, 0, 1, 1},
  {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
  {&__pyx_n_u_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 1, 0, 1},
  {&__pyx_n_s_fltr, __pyx_k_fltr, sizeof(__pyx_k_fltr), 0, 0, 1, 1},
  {&__pyx_n_u_fltr, __pyx_k_fltr, sizeof(__pyx_k_fltr), 0, 1, 0, 1},
  {&__pyx_n_s_fltr0, __pyx_k_fltr0, sizeof(__pyx_k_fltr0), 0, 0, 1, 1},
  {&__pyx_n_s_fltrs, __pyx_k_fltrs, sizeof(__pyx_k_fltrs), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  {&__pyx_n_s_forward_euler_integration, __pyx_k_forward_euler_integration, sizeof(__pyx_k_forward_euler_integration), 0, 0, 1, 1},
  {&__pyx_n_u_fsa, __pyx_k_fsa, sizeof(__pyx_k_fsa), 0, 1, 0, 1},
  {&__pyx_n_s_ftol, __pyx_k_ftol, sizeof(__pyx_k_ftol), 0, 0, 1, 1},
  {&__pyx_n_s_full, __pyx_k_full, sizeof(__pyx_k_full), 0, 0, 1, 1},
  {&__pyx_n_s_full_time_dep_param_mapping, __pyx_k_full_time_dep_param_mapping, sizeof(__pyx_k_full_time_dep_param_mapping), 0, 0, 1, 1},
  {&__pyx_n_u_gA, __pyx_k_gA, sizeof(__pyx_k_gA), 0, 1, 0, 1},
  {&__pyx_n_u_gE, __pyx_k_gE, sizeof(__pyx_k_gE), 0, 1, 0, 1},
  {&__pyx_n_u_gIa, __pyx_k_gIa, sizeof(__pyx_k_gIa), 0, 1, 0, 1},
  {&__pyx_n_u_gIs, __pyx_k_gIs, sizeof(__pyx_k_gIs), 0, 1, 0, 1},
  {&__pyx_n_s_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 0, 1, 1},
  {&__pyx_n_u_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 1, 0, 1},
  {&__pyx_n_s_get_chain, __pyx_k_get_chain, sizeof(__pyx_k_get_chain), 0, 0, 1, 1},
  {&__pyx_n_s_get_log_prob, __pyx_k_get_log_prob, sizeof(__pyx_k_get_log_prob), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_global_atol, __pyx_k_global_atol, sizeof(__pyx_k_global_atol), 0, 0, 1, 1},
  {&__pyx_n_s_global_max_iter, __pyx_k_global_max_iter, sizeof(__pyx_k_global_max_iter), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_grad, __pyx_k_grad, sizeof(__pyx_k_grad), 0, 0, 1, 1},
  {&__pyx_n_s_gradient, __pyx_k_gradient, sizeof(__pyx_k_gradient), 0, 0, 1, 1},
  {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1},
  {&__pyx_n_s_hessian, __pyx_k_hessian, sizeof(__pyx_k_hessian), 0, 0, 1, 1},
  {&__pyx_n_s_hessian_finite_difference, __pyx_k_hessian_finite_difference, sizeof(__pyx_k_hessian_finite_difference), 0, 0, 1, 1},
  {&__pyx_n_s_hessian_locals_minuslogp, __pyx_k_hessian_locals_minuslogp, sizeof(__pyx_k_hessian_locals_minuslogp), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_identity, __pyx_k_identity, sizeof(__pyx_k_identity), 0, 0, 1, 1},
  {&__pyx_n_s_imatmul, __pyx_k_imatmul, sizeof(__pyx_k_imatmul), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_infer, __pyx_k_infer, sizeof(__pyx_k_infer), 0, 0, 1, 1},
  {&__pyx_n_s_infer_mcmc, __pyx_k_infer_mcmc, sizeof(__pyx_k_infer_mcmc), 0, 0, 1, 1},
  {&__pyx_n_s_infer_mcmc_process_result, __pyx_k_infer_mcmc_process_result, sizeof(__pyx_k_infer_mcmc_process_result), 0, 0, 1, 1},
  {&__pyx_n_s_infer_nested_sampling, __pyx_k_infer_nested_sampling, sizeof(__pyx_k_infer_nested_sampling), 0, 0, 1, 1},
  {&__pyx_n_s_infer_nested_sampling_process_re, __pyx_k_infer_nested_sampling_process_re, sizeof(__pyx_k_infer_nested_sampling_process_re), 0, 0, 1, 1},
  {&__pyx_n_s_infer_result, __pyx_k_infer_result, sizeof(__pyx_k_infer_result), 0, 0, 1, 1},
  {&__pyx_n_s_infer_to_minimize, __pyx_k_infer_to_minimize, sizeof(__pyx_k_infer_to_minimize), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init_flags, __pyx_k_init_flags, sizeof(__pyx_k_init_flags), 0, 0, 1, 1},
  {&__pyx_n_u_init_flags, __pyx_k_init_flags, sizeof(__pyx_k_init_flags), 0, 1, 0, 1},
  {&__pyx_n_s_init_fltrs, __pyx_k_init_fltrs, sizeof(__pyx_k_init_fltrs), 0, 0, 1, 1},
  {&__pyx_n_u_init_fltrs, __pyx_k_init_fltrs, sizeof(__pyx_k_init_fltrs), 0, 1, 0, 1},
  {&__pyx_n_s_init_guess, __pyx_k_init_guess, sizeof(__pyx_k_init_guess), 0, 0, 1, 1},
  {&__pyx_n_s_init_priors, __pyx_k_init_priors, sizeof(__pyx_k_init_priors), 0, 0, 1, 1},
  {&__pyx_n_s_input_parameters, __pyx_k_input_parameters, sizeof(__pyx_k_input_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_integrate, __pyx_k_integrate, sizeof(__pyx_k_integrate), 0, 0, 1, 1},
  {&__pyx_n_s_integrate_locals_rhs0, __pyx_k_integrate_locals_rhs0, sizeof(__pyx_k_integrate_locals_rhs0), 0, 0, 1, 1},
  {&__pyx_n_s_inter_steps, __pyx_k_inter_steps, sizeof(__pyx_k_inter_steps), 0, 0, 1, 1},
  {&__pyx_n_u_inter_steps, __pyx_k_inter_steps, sizeof(__pyx_k_inter_steps), 0, 1, 0, 1},
  {&__pyx_n_s_interp1d, __pyx_k_interp1d, sizeof(__pyx_k_interp1d), 0, 0, 1, 1},
  {&__pyx_n_s_interpolate, __pyx_k_interpolate, sizeof(__pyx_k_interpolate), 0, 0, 1, 1},
  {&__pyx_n_s_interpolate_euler, __pyx_k_interpolate_euler, sizeof(__pyx_k_interpolate_euler), 0, 0, 1, 1},
  {&__pyx_n_s_intervention_custom_temporal, __pyx_k_intervention_custom_temporal, sizeof(__pyx_k_intervention_custom_temporal), 0, 0, 1, 1},
  {&__pyx_n_s_intervention_fun, __pyx_k_intervention_fun, sizeof(__pyx_k_intervention_fun), 0, 0, 1, 1},
  {&__pyx_n_u_intervention_fun, __pyx_k_intervention_fun, sizeof(__pyx_k_intervention_fun), 0, 1, 0, 1},
  {&__pyx_n_s_intp, __pyx_k_intp, sizeof(__pyx_k_intp), 0, 0, 1, 1},
  {&__pyx_n_s_inv, __pyx_k_inv, sizeof(__pyx_k_inv), 0, 0, 1, 1},
  {&__pyx_n_s_invert, __pyx_k_invert, sizeof(__pyx_k_invert), 0, 0, 1, 1},
  {&__pyx_kp_u_is_not_a_parameter_of_the_model, __pyx_k_is_not_a_parameter_of_the_model, sizeof(__pyx_k_is_not_a_parameter_of_the_model), 0, 1, 0, 0},
  {&__pyx_n_s_is_scale_parameter, __pyx_k_is_scale_parameter, sizeof(__pyx_k_is_scale_parameter), 0, 0, 1, 1},
  {&__pyx_n_u_is_scale_parameter, __pyx_k_is_scale_parameter, sizeof(__pyx_k_is_scale_parameter), 0, 1, 0, 1},
  {&__pyx_n_s_isclose, __pyx_k_isclose, sizeof(__pyx_k_isclose), 0, 0, 1, 1},
  {&__pyx_n_s_isscalar, __pyx_k_isscalar, sizeof(__pyx_k_isscalar), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_u_kapE, __pyx_k_kapE, sizeof(__pyx_k_kapE), 0, 1, 0, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_u_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 1, 0, 1},
  {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_largest_real_eig, __pyx_k_largest_real_eig, sizeof(__pyx_k_largest_real_eig), 0, 0, 1, 1},
  {&__pyx_n_s_latent_FIM_det_locals_mean, __pyx_k_latent_FIM_det_locals_mean, sizeof(__pyx_k_latent_FIM_det_locals_mean), 0, 0, 1, 1},
  {&__pyx_n_s_latent_FIM_locals_covariance, __pyx_k_latent_FIM_locals_covariance, sizeof(__pyx_k_latent_FIM_locals_covariance), 0, 0, 1, 1},
  {&__pyx_n_s_latent_FIM_locals_mean, __pyx_k_latent_FIM_locals_mean, sizeof(__pyx_k_latent_FIM_locals_mean), 0, 0, 1, 1},
  {&__pyx_n_s_latent_cov, __pyx_k_latent_cov, sizeof(__pyx_k_latent_cov), 0, 0, 1, 1},
  {&__pyx_n_s_latent_hessian, __pyx_k_latent_hessian, sizeof(__pyx_k_latent_hessian), 0, 0, 1, 1},
  {&__pyx_n_s_latent_hessian_locals_minuslogp, __pyx_k_latent_hessian_locals_minuslogp, sizeof(__pyx_k_latent_hessian_locals_minuslogp), 0, 0, 1, 1},
  {&__pyx_n_s_latent_infer, __pyx_k_latent_infer, sizeof(__pyx_k_latent_infer), 0, 0, 1, 1},
  {&__pyx_n_s_latent_infer_mcmc, __pyx_k_latent_infer_mcmc, sizeof(__pyx_k_latent_infer_mcmc), 0, 0, 1, 1},
  {&__pyx_n_s_latent_infer_mcmc_process_result, __pyx_k_latent_infer_mcmc_process_result, sizeof(__pyx_k_latent_infer_mcmc_process_result), 0, 0, 1, 1},
  {&__pyx_n_s_latent_infer_nested_sampling, __pyx_k_latent_infer_nested_sampling, sizeof(__pyx_k_latent_infer_nested_sampling), 0, 0, 1, 1},
  {&__pyx_n_s_latent_infer_nested_sampling_pro, __pyx_k_latent_infer_nested_sampling_pro, sizeof(__pyx_k_latent_infer_nested_sampling_pro), 0, 0, 1, 1},
  {&__pyx_n_s_latent_infer_to_minimize, __pyx_k_latent_infer_to_minimize, sizeof(__pyx_k_latent_infer_to_minimize), 0, 0, 1, 1},
  {&__pyx_n_s_latent_mean, __pyx_k_latent_mean, sizeof(__pyx_k_latent_mean), 0, 0, 1, 1},
  {&__pyx_n_s_lin_mode_inits, __pyx_k_lin_mode_inits, sizeof(__pyx_k_lin_mode_inits), 0, 0, 1, 1},
  {&__pyx_n_s_linalg, __pyx_k_linalg, sizeof(__pyx_k_linalg), 0, 0, 1, 1},
  {&__pyx_n_u_linear, __pyx_k_linear, sizeof(__pyx_k_linear), 0, 1, 0, 1},
  {&__pyx_n_s_linspace, __pyx_k_linspace, sizeof(__pyx_k_linspace), 0, 0, 1, 1},
  {&__pyx_n_s_local_max_iter, __pyx_k_local_max_iter, sizeof(__pyx_k_local_max_iter), 0, 0, 1, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_u_log_likelihood, __pyx_k_log_likelihood, sizeof(__pyx_k_log_likelihood), 0, 1, 0, 1},
  {&__pyx_n_u_log_posterior, __pyx_k_log_posterior, sizeof(__pyx_k_log_posterior), 0, 1, 0, 1},
  {&__pyx_n_u_log_prior, __pyx_k_log_prior, sizeof(__pyx_k_log_prior), 0, 1, 0, 1},
  {&__pyx_n_s_logl, __pyx_k_logl, sizeof(__pyx_k_logl), 0, 0, 1, 1},
  {&__pyx_n_s_logl_kwargs, __pyx_k_logl_kwargs, sizeof(__pyx_k_logl_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_loglike, __pyx_k_loglike, sizeof(__pyx_k_loglike), 0, 0, 1, 1},
  {&__pyx_n_s_loglike_latent, __pyx_k_loglike_latent, sizeof(__pyx_k_loglike_latent), 0, 0, 1, 1},
  {&__pyx_n_s_loglikelihood, __pyx_k_loglikelihood, sizeof(__pyx_k_loglikelihood), 0, 0, 1, 1},
  {&__pyx_n_s_loglikelihood_latent, __pyx_k_loglikelihood_latent, sizeof(__pyx_k_loglikelihood_latent), 0, 0, 1, 1},
  {&__pyx_n_s_lognorm, __pyx_k_lognorm, sizeof(__pyx_k_lognorm), 0, 0, 1, 1},
  {&__pyx_n_s_logpdf, __pyx_k_logpdf, sizeof(__pyx_k_logpdf), 0, 0, 1, 1},
  {&__pyx_n_s_logposterior, __pyx_k_logposterior, sizeof(__pyx_k_logposterior), 0, 0, 1, 1},
  {&__pyx_n_s_logposterior_latent, __pyx_k_logposterior_latent, sizeof(__pyx_k_logposterior_latent), 0, 0, 1, 1},
  {&__pyx_n_s_logwt, __pyx_k_logwt, sizeof(__pyx_k_logwt), 0, 0, 1, 1},
  {&__pyx_n_s_logz, __pyx_k_logz, sizeof(__pyx_k_logz), 0, 0, 1, 1},
  {&__pyx_n_s_lyapunov_method, __pyx_k_lyapunov_method, sizeof(__pyx_k_lyapunov_method), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_det_model, __pyx_k_make_det_model, sizeof(__pyx_k_make_det_model), 0, 0, 1, 1},
  {&__pyx_n_s_make_interp_spline, __pyx_k_make_interp_spline, sizeof(__pyx_k_make_interp_spline), 0, 0, 1, 1},
  {&__pyx_n_s_make_params_dict, __pyx_k_make_params_dict, sizeof(__pyx_k_make_params_dict), 0, 0, 1, 1},
  {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
  {&__pyx_n_u_map_dict, __pyx_k_map_dict, sizeof(__pyx_k_map_dict), 0, 1, 0, 1},
  {&__pyx_n_s_map_estimate, __pyx_k_map_estimate, sizeof(__pyx_k_map_estimate), 0, 0, 1, 1},
  {&__pyx_n_u_map_params_dict, __pyx_k_map_params_dict, sizeof(__pyx_k_map_params_dict), 0, 1, 0, 1},
  {&__pyx_n_u_map_x0, __pyx_k_map_x0, sizeof(__pyx_k_map_x0), 0, 1, 0, 1},
  {&__pyx_n_s_maps_temp, __pyx_k_maps_temp, sizeof(__pyx_k_maps_temp), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_s_matmul, __pyx_k_matmul, sizeof(__pyx_k_matmul), 0, 0, 1, 1},
  {&__pyx_n_s_matrix_rank, __pyx_k_matrix_rank, sizeof(__pyx_k_matrix_rank), 0, 0, 1, 1},
  {&__pyx_n_s_maxNumSteps, __pyx_k_maxNumSteps, sizeof(__pyx_k_maxNumSteps), 0, 0, 1, 1},
  {&__pyx_n_s_max_step, __pyx_k_max_step, sizeof(__pyx_k_max_step), 0, 0, 1, 1},
  {&__pyx_n_s_maxcall, __pyx_k_maxcall, sizeof(__pyx_k_maxcall), 0, 0, 1, 1},
  {&__pyx_n_s_maxiter, __pyx_k_maxiter, sizeof(__pyx_k_maxiter), 0, 0, 1, 1},
  {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1},
  {&__pyx_n_s_mean_2, __pyx_k_mean_2, sizeof(__pyx_k_mean_2), 0, 0, 1, 1},
  {&__pyx_n_s_mean_cov_for_lat_endpoint, __pyx_k_mean_cov_for_lat_endpoint, sizeof(__pyx_k_mean_cov_for_lat_endpoint), 0, 0, 1, 1},
  {&__pyx_n_s_mean_cov_for_lat_traj, __pyx_k_mean_cov_for_lat_traj, sizeof(__pyx_k_mean_cov_for_lat_traj), 0, 0, 1, 1},
  {&__pyx_n_s_measurement_error, __pyx_k_measurement_error, sizeof(__pyx_k_measurement_error), 0, 0, 1, 1},
  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  {&__pyx_n_s_meshgrid, __pyx_k_meshgrid, sizeof(__pyx_k_meshgrid), 0, 0, 1, 1},
  {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
  {&__pyx_n_s_minimization, __pyx_k_minimization, sizeof(__pyx_k_minimization), 0, 0, 1, 1},
  {&__pyx_n_s_minimize, __pyx_k_minimize, sizeof(__pyx_k_minimize), 0, 0, 1, 1},
  {&__pyx_n_s_minimum, __pyx_k_minimum, sizeof(__pyx_k_minimum), 0, 0, 1, 1},
  {&__pyx_n_s_minuslogp, __pyx_k_minuslogp, sizeof(__pyx_k_minuslogp), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_model_spec, __pyx_k_model_spec, sizeof(__pyx_k_model_spec), 0, 0, 1, 1},
  {&__pyx_n_s_multiply, __pyx_k_multiply, sizeof(__pyx_k_multiply), 0, 0, 1, 1},
  {&__pyx_n_s_multivariate_normal, __pyx_k_multivariate_normal, sizeof(__pyx_k_multivariate_normal), 0, 0, 1, 1},
  {&__pyx_n_s_nClass, __pyx_k_nClass, sizeof(__pyx_k_nClass), 0, 0, 1, 1},
  {&__pyx_n_s_n_effective, __pyx_k_n_effective, sizeof(__pyx_k_n_effective), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_nested_sampling_prior_transform, __pyx_k_nested_sampling_prior_transform, sizeof(__pyx_k_nested_sampling_prior_transform), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1},
  {&__pyx_kp_u_not_implemented_Choose_between, __pyx_k_not_implemented_Choose_between, sizeof(__pyx_k_not_implemented_Choose_between), 0, 1, 0, 0},
  {&__pyx_kp_u_not_implemented_Choose_between_2, __pyx_k_not_implemented_Choose_between_2, sizeof(__pyx_k_not_implemented_Choose_between_2), 0, 1, 0, 0},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_nprocesses, __pyx_k_nprocesses, sizeof(__pyx_k_nprocesses), 0, 0, 1, 1},
  {&__pyx_n_s_nsamples, __pyx_k_nsamples, sizeof(__pyx_k_nsamples), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_nwalkers, __pyx_k_nwalkers, sizeof(__pyx_k_nwalkers), 0, 0, 1, 1},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_u_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 1, 0, 1},
  {&__pyx_n_s_obs, __pyx_k_obs, sizeof(__pyx_k_obs), 0, 0, 1, 1},
  {&__pyx_n_u_obs, __pyx_k_obs, sizeof(__pyx_k_obs), 0, 1, 0, 1},
  {&__pyx_n_s_obs0, __pyx_k_obs0, sizeof(__pyx_k_obs0), 0, 0, 1, 1},
  {&__pyx_n_u_obs0, __pyx_k_obs0, sizeof(__pyx_k_obs0), 0, 1, 0, 1},
  {&__pyx_n_s_obs_flattened, __pyx_k_obs_flattened, sizeof(__pyx_k_obs_flattened), 0, 0, 1, 1},
  {&__pyx_n_s_obtain_full_mean_cov, __pyx_k_obtain_full_mean_cov, sizeof(__pyx_k_obtain_full_mean_cov), 0, 0, 1, 1},
  {&__pyx_n_s_obtain_full_mean_cov_tangent_spa, __pyx_k_obtain_full_mean_cov_tangent_spa, sizeof(__pyx_k_obtain_full_mean_cov_tangent_spa), 0, 0, 1, 1},
  {&__pyx_n_s_obtain_time_evol_op, __pyx_k_obtain_time_evol_op, sizeof(__pyx_k_obtain_time_evol_op), 0, 0, 1, 1},
  {&__pyx_n_s_obtain_time_evol_op_2, __pyx_k_obtain_time_evol_op_2, sizeof(__pyx_k_obtain_time_evol_op_2), 0, 0, 1, 1},
  {&__pyx_n_s_obtain_time_evol_op_locals_rhs, __pyx_k_obtain_time_evol_op_locals_rhs, sizeof(__pyx_k_obtain_time_evol_op_locals_rhs), 0, 0, 1, 1},
  {&__pyx_n_s_ord, __pyx_k_ord, sizeof(__pyx_k_ord), 0, 0, 1, 1},
  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  {&__pyx_n_s_param_1, __pyx_k_param_1, sizeof(__pyx_k_param_1), 0, 0, 1, 1},
  {&__pyx_n_s_param_2, __pyx_k_param_2, sizeof(__pyx_k_param_2), 0, 0, 1, 1},
  {&__pyx_n_s_param_guess_range, __pyx_k_param_guess_range, sizeof(__pyx_k_param_guess_range), 0, 0, 1, 1},
  {&__pyx_n_u_param_guess_range, __pyx_k_param_guess_range, sizeof(__pyx_k_param_guess_range), 0, 1, 0, 1},
  {&__pyx_n_s_param_keys, __pyx_k_param_keys, sizeof(__pyx_k_param_keys), 0, 0, 1, 1},
  {&__pyx_n_u_param_keys, __pyx_k_param_keys, sizeof(__pyx_k_param_keys), 0, 1, 0, 1},
  {&__pyx_n_s_param_length, __pyx_k_param_length, sizeof(__pyx_k_param_length), 0, 0, 1, 1},
  {&__pyx_n_u_param_length, __pyx_k_param_length, sizeof(__pyx_k_param_length), 0, 1, 0, 1},
  {&__pyx_n_s_param_pos_1, __pyx_k_param_pos_1, sizeof(__pyx_k_param_pos_1), 0, 0, 1, 1},
  {&__pyx_n_s_param_pos_2, __pyx_k_param_pos_2, sizeof(__pyx_k_param_pos_2), 0, 0, 1, 1},
  {&__pyx_n_s_param_priors, __pyx_k_param_priors, sizeof(__pyx_k_param_priors), 0, 0, 1, 1},
  {&__pyx_n_s_parameter_mapping, __pyx_k_parameter_mapping, sizeof(__pyx_k_parameter_mapping), 0, 0, 1, 1},
  {&__pyx_n_s_parameters, __pyx_k_parameters, sizeof(__pyx_k_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_params, __pyx_k_params, sizeof(__pyx_k_params), 0, 0, 1, 1},
  {&__pyx_n_u_params_dict, __pyx_k_params_dict, sizeof(__pyx_k_params_dict), 0, 1, 0, 1},
  {&__pyx_n_s_parse_init_prior_dict, __pyx_k_parse_init_prior_dict, sizeof(__pyx_k_parse_init_prior_dict), 0, 0, 1, 1},
  {&__pyx_n_s_parse_model_spec, __pyx_k_parse_model_spec, sizeof(__pyx_k_parse_model_spec), 0, 0, 1, 1},
  {&__pyx_n_s_parse_param_prior_dict, __pyx_k_parse_param_prior_dict, sizeof(__pyx_k_parse_param_prior_dict), 0, 0, 1, 1},
  {&__pyx_n_s_partial_derivative, __pyx_k_partial_derivative, sizeof(__pyx_k_partial_derivative), 0, 0, 1, 1},
  {&__pyx_n_s_pathos_mp, __pyx_k_pathos_mp, sizeof(__pyx_k_pathos_mp), 0, 0, 1, 1},
  {&__pyx_n_s_pathos_multiprocessing, __pyx_k_pathos_multiprocessing, sizeof(__pyx_k_pathos_multiprocessing), 0, 0, 1, 1},
  {&__pyx_n_s_permutedims, __pyx_k_permutedims, sizeof(__pyx_k_permutedims), 0, 0, 1, 1},
  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1},
  {&__pyx_n_s_pool, __pyx_k_pool, sizeof(__pyx_k_pool), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_ppf, __pyx_k_ppf, sizeof(__pyx_k_ppf), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_print_progress, __pyx_k_print_progress, sizeof(__pyx_k_print_progress), 0, 0, 1, 1},
  {&__pyx_n_s_prior, __pyx_k_prior, sizeof(__pyx_k_prior), 0, 0, 1, 1},
  {&__pyx_n_u_prior, __pyx_k_prior, sizeof(__pyx_k_prior), 0, 1, 0, 1},
  {&__pyx_n_s_prior_dict, __pyx_k_prior_dict, sizeof(__pyx_k_prior_dict), 0, 0, 1, 1},
  {&__pyx_n_s_process_contact_matrix, __pyx_k_process_contact_matrix, sizeof(__pyx_k_process_contact_matrix), 0, 0, 1, 1},
  {&__pyx_n_s_process_fltr, __pyx_k_process_fltr, sizeof(__pyx_k_process_fltr), 0, 0, 1, 1},
  {&__pyx_n_s_process_latent_data, __pyx_k_process_latent_data, sizeof(__pyx_k_process_latent_data), 0, 0, 1, 1},
  {&__pyx_n_s_process_obs, __pyx_k_process_obs, sizeof(__pyx_k_process_obs), 0, 0, 1, 1},
  {&__pyx_n_s_progress, __pyx_k_progress, sizeof(__pyx_k_progress), 0, 0, 1, 1},
  {&__pyx_n_s_ptform_kwargs, __pyx_k_ptform_kwargs, sizeof(__pyx_k_ptform_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_pyross, __pyx_k_pyross, sizeof(__pyx_k_pyross), 0, 0, 1, 1},
  {&__pyx_n_s_pyross_contactMatrix, __pyx_k_pyross_contactMatrix, sizeof(__pyx_k_pyross_contactMatrix), 0, 0, 1, 1},
  {&__pyx_n_s_pyross_deterministic, __pyx_k_pyross_deterministic, sizeof(__pyx_k_pyross_deterministic), 0, 0, 1, 1},
  {&__pyx_n_s_pyross_inference, __pyx_k_pyross_inference, sizeof(__pyx_k_pyross_inference), 0, 0, 1, 1},
  {&__pyx_kp_s_pyross_inference_pyx, __pyx_k_pyross_inference_pyx, sizeof(__pyx_k_pyross_inference_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_pyross_utils_python, __pyx_k_pyross_utils_python, sizeof(__pyx_k_pyross_utils_python), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SEAIRQ, __pyx_k_pyx_unpickle_SEAIRQ, sizeof(__pyx_k_pyx_unpickle_SEAIRQ), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SEAIRQ_testing, __pyx_k_pyx_unpickle_SEAIRQ_testing, sizeof(__pyx_k_pyx_unpickle_SEAIRQ_testing), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SEIR, __pyx_k_pyx_unpickle_SEIR, sizeof(__pyx_k_pyx_unpickle_SEIR), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SIR, __pyx_k_pyx_unpickle_SIR, sizeof(__pyx_k_pyx_unpickle_SIR), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SIR_type, __pyx_k_pyx_unpickle_SIR_type, sizeof(__pyx_k_pyx_unpickle_SIR_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Spp, __pyx_k_pyx_unpickle_Spp, sizeof(__pyx_k_pyx_unpickle_Spp), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SppQ, __pyx_k_pyx_unpickle_SppQ, sizeof(__pyx_k_pyx_unpickle_SppQ), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SppQ_old, __pyx_k_pyx_unpickle_SppQ_old, sizeof(__pyx_k_pyx_unpickle_SppQ_old), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_SppSparse, __pyx_k_pyx_unpickle_SppSparse, sizeof(__pyx_k_pyx_unpickle_SppSparse), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_quad, __pyx_k_quad, sizeof(__pyx_k_quad), 0, 0, 1, 1},
  {&__pyx_n_s_queue_size, __pyx_k_queue_size, sizeof(__pyx_k_queue_size), 0, 0, 1, 1},
  {&__pyx_n_s_rand, __pyx_k_rand, sizeof(__pyx_k_rand), 0, 0, 1, 1},
  {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_range_1, __pyx_k_range_1, sizeof(__pyx_k_range_1), 0, 0, 1, 1},
  {&__pyx_n_s_range_2, __pyx_k_range_2, sizeof(__pyx_k_range_2), 0, 0, 1, 1},
  {&__pyx_n_s_ravel, __pyx_k_ravel, sizeof(__pyx_k_ravel), 0, 0, 1, 1},
  {&__pyx_n_s_ravel_multi_index, __pyx_k_ravel_multi_index, sizeof(__pyx_k_ravel_multi_index), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_repeat, __pyx_k_repeat, sizeof(__pyx_k_repeat), 0, 0, 1, 1},
  {&__pyx_n_s_repeats, __pyx_k_repeats, sizeof(__pyx_k_repeats), 0, 0, 1, 1},
  {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1},
  {&__pyx_n_s_resolution_1, __pyx_k_resolution_1, sizeof(__pyx_k_resolution_1), 0, 0, 1, 1},
  {&__pyx_n_s_resolution_2, __pyx_k_resolution_2, sizeof(__pyx_k_resolution_2), 0, 0, 1, 1},
  {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
  {&__pyx_n_s_return_additional_params, __pyx_k_return_additional_params, sizeof(__pyx_k_return_additional_params), 0, 0, 1, 1},
  {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1},
  {&__pyx_n_s_rhs0, __pyx_k_rhs0, sizeof(__pyx_k_rhs0), 0, 0, 1, 1},
  {&__pyx_n_s_rhs0_2, __pyx_k_rhs0_2, sizeof(__pyx_k_rhs0_2), 0, 0, 1, 1},
  {&__pyx_n_s_rmatmul, __pyx_k_rmatmul, sizeof(__pyx_k_rmatmul), 0, 0, 1, 1},
  {&__pyx_n_s_robustness_locals_bilinear, __pyx_k_robustness_locals_bilinear, sizeof(__pyx_k_robustness_locals_bilinear), 0, 0, 1, 1},
  {&__pyx_n_s_rq, __pyx_k_rq, sizeof(__pyx_k_rq), 0, 0, 1, 1},
  {&__pyx_n_s_rtol, __pyx_k_rtol, sizeof(__pyx_k_rtol), 0, 0, 1, 1},
  {&__pyx_n_s_rtol_det, __pyx_k_rtol_det, sizeof(__pyx_k_rtol_det), 0, 0, 1, 1},
  {&__pyx_n_s_rtol_lyapunov, __pyx_k_rtol_lyapunov, sizeof(__pyx_k_rtol_lyapunov), 0, 0, 1, 1},
  {&__pyx_n_s_run_mcmc, __pyx_k_run_mcmc, sizeof(__pyx_k_run_mcmc), 0, 0, 1, 1},
  {&__pyx_n_s_run_nested, __pyx_k_run_nested, sizeof(__pyx_k_run_nested), 0, 0, 1, 1},
  {&__pyx_n_s_sampler, __pyx_k_sampler, sizeof(__pyx_k_sampler), 0, 0, 1, 1},
  {&__pyx_n_s_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 0, 1, 1},
  {&__pyx_n_s_scaled_guesses, __pyx_k_scaled_guesses, sizeof(__pyx_k_scaled_guesses), 0, 0, 1, 1},
  {&__pyx_n_u_scaled_guesses, __pyx_k_scaled_guesses, sizeof(__pyx_k_scaled_guesses), 0, 1, 0, 1},
  {&__pyx_n_s_scaled_param_guesses, __pyx_k_scaled_param_guesses, sizeof(__pyx_k_scaled_param_guesses), 0, 0, 1, 1},
  {&__pyx_n_u_scaled_param_guesses, __pyx_k_scaled_param_guesses, sizeof(__pyx_k_scaled_param_guesses), 0, 1, 0, 1},
  {&__pyx_n_s_scipy, __pyx_k_scipy, sizeof(__pyx_k_scipy), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_integrate, __pyx_k_scipy_integrate, sizeof(__pyx_k_scipy_integrate), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_interpolate, __pyx_k_scipy_interpolate, sizeof(__pyx_k_scipy_interpolate), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_linalg, __pyx_k_scipy_linalg, sizeof(__pyx_k_scipy_linalg), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_optimize, __pyx_k_scipy_optimize, sizeof(__pyx_k_scipy_optimize), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_stats, __pyx_k_scipy_stats, sizeof(__pyx_k_scipy_stats), 0, 0, 1, 1},
  {&__pyx_n_s_set_contactMatrix, __pyx_k_set_contactMatrix, sizeof(__pyx_k_set_contactMatrix), 0, 0, 1, 1},
  {&__pyx_n_s_set_det_model, __pyx_k_set_det_model, sizeof(__pyx_k_set_det_model), 0, 0, 1, 1},
  {&__pyx_n_s_set_params, __pyx_k_set_params, sizeof(__pyx_k_set_params), 0, 0, 1, 1},
  {&__pyx_n_s_set_time_dep_model_parameters, __pyx_k_set_time_dep_model_parameters, sizeof(__pyx_k_set_time_dep_model_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_sig, __pyx_k_sig, sizeof(__pyx_k_sig), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_smooth_penalty, __pyx_k_smooth_penalty, sizeof(__pyx_k_smooth_penalty), 0, 0, 1, 1},
  {&__pyx_n_s_sol, __pyx_k_sol, sizeof(__pyx_k_sol), 0, 0, 1, 1},
  {&__pyx_n_s_solve, __pyx_k_solve, sizeof(__pyx_k_solve), 0, 0, 1, 1},
  {&__pyx_n_s_solve_ivp, __pyx_k_solve_ivp, sizeof(__pyx_k_solve_ivp), 0, 0, 1, 1},
  {&__pyx_n_s_solve_lyapunov_type_eq, __pyx_k_solve_lyapunov_type_eq, sizeof(__pyx_k_solve_lyapunov_type_eq), 0, 0, 1, 1},
  {&__pyx_n_s_solve_symmetric_close_to_singula, __pyx_k_solve_symmetric_close_to_singula, sizeof(__pyx_k_solve_symmetric_close_to_singula), 0, 0, 1, 1},
  {&__pyx_n_s_solve_triangular, __pyx_k_solve_triangular, sizeof(__pyx_k_solve_triangular), 0, 0, 1, 1},
  {&__pyx_n_s_spacing, __pyx_k_spacing, sizeof(__pyx_k_spacing), 0, 0, 1, 1},
  {&__pyx_n_s_sparse, __pyx_k_sparse, sizeof(__pyx_k_sparse), 0, 0, 1, 1},
  {&__pyx_n_s_split_spaces, __pyx_k_split_spaces, sizeof(__pyx_k_split_spaces), 0, 0, 1, 1},
  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_steps, __pyx_k_steps, sizeof(__pyx_k_steps), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  {&__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},
  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  {&__pyx_n_s_subtract, __pyx_k_subtract, sizeof(__pyx_k_subtract), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sympy, __pyx_k_sympy, sizeof(__pyx_k_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_t1, __pyx_k_t1, sizeof(__pyx_k_t1), 0, 0, 1, 1},
  {&__pyx_n_s_t2, __pyx_k_t2, sizeof(__pyx_k_t2), 0, 0, 1, 1},
  {&__pyx_n_u_tA, __pyx_k_tA, sizeof(__pyx_k_tA), 0, 1, 0, 1},
  {&__pyx_n_u_tE, __pyx_k_tE, sizeof(__pyx_k_tE), 0, 1, 0, 1},
  {&__pyx_n_u_tIa, __pyx_k_tIa, sizeof(__pyx_k_tIa), 0, 1, 0, 1},
  {&__pyx_n_u_tIs, __pyx_k_tIs, sizeof(__pyx_k_tIs), 0, 1, 0, 1},
  {&__pyx_n_u_tS, __pyx_k_tS, sizeof(__pyx_k_tS), 0, 1, 0, 1},
  {&__pyx_n_s_t_eval, __pyx_k_t_eval, sizeof(__pyx_k_t_eval), 0, 0, 1, 1},
  {&__pyx_n_s_tangent, __pyx_k_tangent, sizeof(__pyx_k_tangent), 0, 0, 1, 1},
  {&__pyx_n_u_tangent, __pyx_k_tangent, sizeof(__pyx_k_tangent), 0, 1, 0, 1},
  {&__pyx_n_u_tau, __pyx_k_tau, sizeof(__pyx_k_tau), 0, 1, 0, 1},
  {&__pyx_n_s_tensorcontraction, __pyx_k_tensorcontraction, sizeof(__pyx_k_tensorcontraction), 0, 0, 1, 1},
  {&__pyx_n_s_tensorproduct, __pyx_k_tensorproduct, sizeof(__pyx_k_tensorproduct), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_testRate, __pyx_k_testRate, sizeof(__pyx_k_testRate), 0, 0, 1, 1},
  {&__pyx_n_s_thin, __pyx_k_thin, sizeof(__pyx_k_thin), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_time_dep_param_mapping, __pyx_k_time_dep_param_mapping, sizeof(__pyx_k_time_dep_param_mapping), 0, 0, 1, 1},
  {&__pyx_n_s_trace, __pyx_k_trace, sizeof(__pyx_k_trace), 0, 0, 1, 1},
  {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
  {&__pyx_n_s_tril_indices, __pyx_k_tril_indices, sizeof(__pyx_k_tril_indices), 0, 0, 1, 1},
  {&__pyx_n_s_triu_indices, __pyx_k_triu_indices, sizeof(__pyx_k_triu_indices), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_unflatten_parameters, __pyx_k_unflatten_parameters, sizeof(__pyx_k_unflatten_parameters), 0, 0, 1, 1},
  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_update_model_parameters, __pyx_k_update_model_parameters, sizeof(__pyx_k_update_model_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_utils, __pyx_k_utils, sizeof(__pyx_k_utils), 0, 0, 1, 1},
  {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
  {&__pyx_n_s_verbose, __pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 0, 1, 1},
  {&__pyx_n_s_vstack, __pyx_k_vstack, sizeof(__pyx_k_vstack), 0, 0, 1, 1},
  {&__pyx_n_s_walker_pos, __pyx_k_walker_pos, sizeof(__pyx_k_walker_pos), 0, 0, 1, 1},
  {&__pyx_n_u_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 1, 0, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1},
  {&__pyx_n_s_x0, __pyx_k_x0, sizeof(__pyx_k_x0), 0, 0, 1, 1},
  {&__pyx_n_u_x0, __pyx_k_x0, sizeof(__pyx_k_x0), 0, 1, 0, 1},
  {&__pyx_kp_u_x0_not_consistent_with_obs0_Usin, __pyx_k_x0_not_consistent_with_obs0_Usin, sizeof(__pyx_k_x0_not_consistent_with_obs0_Usin), 0, 1, 0, 0},
  {&__pyx_n_s_xt, __pyx_k_xt, sizeof(__pyx_k_xt), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 23, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) __PYX_ERR(0, 568, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 615, __pyx_L1_error)
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 1020, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 1041, __pyx_L1_error)
  __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 3049, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 3139, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 3177, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 3678, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 4466, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 272, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 856, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 400, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 609, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 828, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "pyross/inference.pyx":269
 *         if bounds is not None:
 *             # Check that params is within bounds. If not, return -np.inf.
 *             if np.any(bounds[:,0] > params) or np.any(bounds[:,1] < params):             # <<<<<<<<<<<<<<
 *                 return -np.Inf
 * 
 */
  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);
  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_slice_, __pyx_int_0); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);
  __pyx_tuple__3 = PyTuple_Pack(2, __pyx_slice_, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pyross/inference.pyx":286
 *         else:
 *             if kwargs != {}:
 *                 raise Exception('Key error or unspecified generator')             # <<<<<<<<<<<<<<
 * 
 *         if tangent:
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Key_error_or_unspecified_generat); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pyross/inference.pyx":524
 *         """
 *         if dynesty is None:
 *             raise Exception("Nested sampling needs optional dependency `dynesty` which was not found.")             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses == 0:
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Nested_sampling_needs_optional_d); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pyross/inference.pyx":727
 *         """
 *         if emcee is None:
 *             raise Exception("MCMC sampling needs optional dependency `emcee` which was not found.")             # <<<<<<<<<<<<<<
 * 
 *         if nprocesses == 0:
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_MCMC_sampling_needs_optional_dep); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "pyross/inference.pyx":737
 * 
 *         if nprocesses > 1 and pathos_mp is None:
 *             raise Exception("The Python package `pathos` is needed for multiprocessing.")             # <<<<<<<<<<<<<<
 * 
 *         # Sanity checks of the intputs
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_The_Python_package_pathos_is_nee); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "pyross/inference.pyx":907
 *         else:
 *             xm = self.integrate(x0, 0, Tf, Nf)
 *         return np.ravel(xm[1:])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "pyross/inference.pyx":993
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses']:
 *             kwargs[key] = infer_result_loc[key]
 */
  __pyx_tuple__9 = PyTuple_Pack(4, __pyx_n_u_param_keys, __pyx_n_u_param_guess_range, __pyx_n_u_is_scale_parameter, __pyx_n_u_scaled_param_guesses); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "pyross/inference.pyx":999
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_mean_2, 999, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 999, __pyx_L1_error)

  /* "pyross/inference.pyx":1006
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_covariance, 1006, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 1006, __pyx_L1_error)

  /* "pyross/inference.pyx":1106
 *         x0 = x[0]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_mean_2, 1106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 1106, __pyx_L1_error)

  /* "pyross/inference.pyx":1194
 * 
 *         kwargs = {}
 *         for key in ['is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'prior']:
 *             kwargs[key] = infer_result[key]
 */
  __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_u_is_scale_parameter, __pyx_n_u_scaled_param_guesses, __pyx_n_u_prior); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "pyross/inference.pyx":1211
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._infer_to_minimize(y, x=x, Tf=Tf, tangent=tangent, **kwargs)
 *         hess = pyross.utils.hessian_finite_difference(flat_params, minuslogp, eps, method=fd_method)
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_minuslogp, 1211, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 1211, __pyx_L1_error)

  /* "pyross/inference.pyx":1281
 *         if resolution_2 == None:
 *             resolution_2 = resolution_1
 *         def bilinear(param_1, param_2, det=True):             # <<<<<<<<<<<<<<
 *             maps_temp = np.copy(flat_maps)
 *             maps_temp[param_pos_1] += param_1
 */
  __pyx_tuple__19 = PyTuple_Pack(5, __pyx_n_s_param_1, __pyx_n_s_param_2, __pyx_n_s_det, __pyx_n_s_maps_temp, __pyx_n_s_dev); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_bilinear, 1281, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __pyx_tuple__21 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "pyross/inference.pyx":1327
 *         '''
 *         if not np.all(np.linalg.eigvalsh(FIM)>0):
 *             raise Exception("FIM not positive definite - check for appropriate step-size `eps` in FIM computation and/or increase `inter_steps` for a more stable result")             # <<<<<<<<<<<<<<
 * 
 *         sensitivity_individual = np.sqrt(np.diagonal(FIM))
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_FIM_not_positive_definite_check); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 1327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "pyross/inference.pyx":2594
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs']:
 */
  __pyx_tuple__23 = PyTuple_Pack(7, __pyx_n_u_param_keys, __pyx_n_u_param_guess_range, __pyx_n_u_is_scale_parameter, __pyx_n_u_scaled_param_guesses, __pyx_n_u_param_length, __pyx_n_u_init_flags, __pyx_n_u_init_fltrs); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 2594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "pyross/inference.pyx":2599
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_mean_2, 2599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 2599, __pyx_L1_error)

  /* "pyross/inference.pyx":2607
 *                               **kwargs)
 * 
 *         def covariance(y):             # <<<<<<<<<<<<<<
 *             return self._latent_cov(y, contactMatrix=contactMatrix,
 *                                      generator=generator,
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 2607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_pyross_inference_pyx, __pyx_n_s_covariance, 2607, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 2607, __pyx_L1_error)

  /* "pyross/inference.pyx":2713
 *             kwargs[key] = infer_result_loc[key]
 * 
 *         def mean(y):             # <<<<<<<<<<<<<<
 *             return self._latent_mean(y, contactMatrix=contactMatrix,
 *                                       generator=generator,
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 2713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);
  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_mean_2, 2713, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 2713, __pyx_L1_error)

  /* "pyross/inference.pyx":2810
 * 
 *         kwargs = {}
 *         for key in ['param_keys', 'param_guess_range', 'is_scale_parameter',             # <<<<<<<<<<<<<<
 *                     'scaled_param_guesses', 'param_length', 'init_flags',
 *                     'init_fltrs', 'prior']:
 */
  __pyx_tuple__30 = PyTuple_Pack(8, __pyx_n_u_param_keys, __pyx_n_u_param_guess_range, __pyx_n_u_is_scale_parameter, __pyx_n_u_scaled_param_guesses, __pyx_n_u_param_length, __pyx_n_u_init_flags, __pyx_n_u_init_fltrs, __pyx_n_u_prior); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 2810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "pyross/inference.pyx":2827
 *         print('epsilon used for differentiation: ', eps)
 * 
 *         def minuslogp(y):             # <<<<<<<<<<<<<<
 *             return self._latent_infer_to_minimize(y, obs=obs, fltr=fltr, Tf=Tf, obs0=obs0,
 *                                            tangent=tangent, **kwargs)
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 2827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_minuslogp, 2827, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 2827, __pyx_L1_error)

  /* "pyross/inference.pyx":3015
 *         x0_obs = fltr[0].dot(x0)
 *         if not np.allclose(x0_obs, obs0):
 *             print('x0 not consistent with obs0. '             # <<<<<<<<<<<<<<
 *                   'Using x0 in the calculation of logp...')
 *         self.set_params(parameters)
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_x0_not_consistent_with_obs0_Usin); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "pyross/inference.pyx":3139
 *             A dictionary of parameter values, same as the ones required for initialisation.
 *         '''
 *         raise NotImplementedError("Please Implement set_det_model in subclass")             # <<<<<<<<<<<<<<
 * 
 *     def set_contact_matrix(self, contactMatrix):
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_u_Please_Implement_set_det_model_i); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 3139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "pyross/inference.pyx":3154
 * 
 *     def make_params_dict(self):
 *         raise NotImplementedError("Please Implement make_params_dict in subclass")             # <<<<<<<<<<<<<<
 * 
 *     def fill_params_dict(self, keys, params, return_additional_params=False):
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_u_Please_Implement_make_params_dic); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 3154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "pyross/inference.pyx":3393
 *             double [:, :] cov
 * 
 *         def rhs(t, sig):             # <<<<<<<<<<<<<<
 *             x = sol(t)/self.Omega # sol is an ODESolver obj for extensive variables
 *             self.compute_jacobian_and_b_matrix(x, t, b_matrix=True, jacobian=True)
 */
  __pyx_tuple__36 = PyTuple_Pack(3, __pyx_n_s_t, __pyx_n_s_sig, __pyx_n_s_x); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_rhs, 3393, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 3393, __pyx_L1_error)

  /* "pyross/inference.pyx":3515
 *             Py_ssize_t steps=self.steps
 * 
 *         def rhs(t, U_vec):             # <<<<<<<<<<<<<<
 *             xt = sol(t)/self.Omega
 *             self.compute_jacobian_and_b_matrix(xt, t, b_matrix=False, jacobian=True)
 */
  __pyx_tuple__38 = PyTuple_Pack(5, __pyx_n_s_t, __pyx_n_s_U_vec, __pyx_n_s_xt, __pyx_n_s_U_mat, __pyx_n_s_dUdt); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 3515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_rhs, 3515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 3515, __pyx_L1_error)

  /* "pyross/inference.pyx":3541
 *             sol_vec = pyross.utils.RK2_integration(rhs, M0, t1, t2, steps)[steps-1]
 *         else:
 *             raise Exception("Error: lyapunov method not found. Use set_lyapunov_method to change the method")             # <<<<<<<<<<<<<<
 *         return sol_vec
 * 
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_u_Error_lyapunov_method_not_found); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 3541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "pyross/inference.pyx":3572
 *     def _process_contact_matrix(self, contactMatrix, generator, intervention_fun):
 *         if (contactMatrix is None) == (generator is None):
 *             raise Exception('Specify either a fixed contactMatrix or a generator')             # <<<<<<<<<<<<<<
 *         if (intervention_fun is not None) and (generator is None):
 *             raise Exception('Specify a generator')
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_u_Specify_either_a_fixed_contactMa); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 3572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "pyross/inference.pyx":3574
 *             raise Exception('Specify either a fixed contactMatrix or a generator')
 *         if (intervention_fun is not None) and (generator is None):
 *             raise Exception('Specify a generator')             # <<<<<<<<<<<<<<
 *         if contactMatrix is not None:
 *             self.contactMatrix = contactMatrix
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_u_Specify_a_generator); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 3574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "pyross/inference.pyx":3581
 *     cdef compute_jacobian_and_b_matrix(self, double [:] x, double t,
 *                                              b_matrix=True, jacobian=False):
 *         raise NotImplementedError("Please Implement compute_jacobian_and_b_matrix in subclass")             # <<<<<<<<<<<<<<
 * 
 *     def integrate(self, double [:] x0, double t1, double t2, Py_ssize_t steps,
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_u_Please_Implement_compute_jacobia); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 3581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "pyross/inference.pyx":3606
 *         """
 * 
 *         def rhs0(double t, double [:] xt):             # <<<<<<<<<<<<<<
 *             self.det_model.set_contactMatrix(t, self.contactMatrix)
 *             self.det_model.rhs(xt, t)
 */
  __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_t, __pyx_n_s_xt); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyross_inference_pyx, __pyx_n_s_rhs0_2, 3606, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 3606, __pyx_L1_error)

  /* "pyross/inference.pyx":4164
 * 
 *     def infection_indices(self):
 *         return (1, 2, 3, 4)             # <<<<<<<<<<<<<<
 * 
 *     def set_params(self, parameters):
 */
  __pyx_tuple__46 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_2, __pyx_int_3, __pyx_int_4); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 4164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "pyross/inference.pyx":4389
 *                                     det_method='LSODA', lyapunov_method='LSODA', rtol_det=1e-3, rtol_lyapunov=1e-3, parameter_mapping=None, time_dep_param_mapping=None):
 *         if parameter_mapping is not None and time_dep_param_mapping is not None:
 *             raise Exception('Specify either parameter_mapping or time_dep_param_mapping')             # <<<<<<<<<<<<<<
 *         self.parameter_mapping = parameter_mapping
 *         self.time_dep_param_mapping = time_dep_param_mapping
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_u_Specify_either_parameter_mapping); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 4389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "pyross/inference.pyx":4514
 *             r = xrs[self.class_index_dict['R'],:]
 *         if self.constant_terms.size > 0:
 *             r = xrs[-1,:] - np.sum(xrs[:-1,:], axis=0)             # <<<<<<<<<<<<<<
 *         else:
 *             r = self.fi - np.sum(xrs, axis=0)
 */
  __pyx_tuple__48 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_slice_); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 4514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_slice__49 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__49)) __PYX_ERR(0, 4514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__49);
  __Pyx_GIVEREF(__pyx_slice__49);
  __pyx_tuple__50 = PyTuple_Pack(2, __pyx_slice__49, __pyx_slice_); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 4514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(2, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(2, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(2, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(2, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(2, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(2, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "../../../../software/anaconda/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "View.MemoryView":133
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "View.MemoryView":136
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "View.MemoryView":148
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(1, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "View.MemoryView":176
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "View.MemoryView":192
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(1, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "View.MemoryView":414
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "View.MemoryView":491
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
  __pyx_tuple__66 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(1, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "View.MemoryView":516
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
 */
  __pyx_tuple__67 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(1, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);

  /* "View.MemoryView":566
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
  __pyx_tuple__68 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(1, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "View.MemoryView":573
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
  __pyx_tuple__69 = PyTuple_New(1); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_tuple__69, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_tuple__69);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__70 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "View.MemoryView":699
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(1, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__74 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);

  /* "(tree fragment)":1
 * def __pyx_unpickle_SIR_type(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__76 = 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__76)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SIR_type, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__78 = 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__78)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SIR, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__80 = 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__80)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);
  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SEIR, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__82 = 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__82)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SEAIRQ, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__84 = 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__84)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);
  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SEAIRQ_testing, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__86 = 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__86)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Spp, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__88 = 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__88)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);
  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SppQ, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__90 = 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__90)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);
  __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SppQ_old, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__92 = 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__92)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);
  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SppSparse, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(1, 1, __pyx_L1_error)

  /* "View.MemoryView":286
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(1, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "View.MemoryView":287
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_tuple__95 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(1, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "View.MemoryView":288
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(1, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "View.MemoryView":291
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(1, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "View.MemoryView":292
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(1, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__99 = 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__99)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_25 = PyFloat_FromDouble(0.25); if (unlikely(!__pyx_float_0_25)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_2 = PyFloat_FromDouble(1e-2); if (unlikely(!__pyx_float_1eneg_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_3 = PyFloat_FromDouble(1e-3); if (unlikely(!__pyx_float_1eneg_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_4 = PyFloat_FromDouble(1e-4); if (unlikely(!__pyx_float_1eneg_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_5 = PyFloat_FromDouble(1e-5); if (unlikely(!__pyx_float_1eneg_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_6 = PyFloat_FromDouble(1e-6); if (unlikely(!__pyx_float_1eneg_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100000 = PyInt_FromLong(100000L); if (unlikely(!__pyx_int_100000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6898761 = PyInt_FromLong(6898761L); if (unlikely(!__pyx_int_6898761)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_23253038 = PyInt_FromLong(23253038L); if (unlikely(!__pyx_int_23253038)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_23519854 = PyInt_FromLong(23519854L); if (unlikely(!__pyx_int_23519854)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_43267880 = PyInt_FromLong(43267880L); if (unlikely(!__pyx_int_43267880)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_96728239 = PyInt_FromLong(96728239L); if (unlikely(!__pyx_int_96728239)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_172004068 = PyInt_FromLong(172004068L); if (unlikely(!__pyx_int_172004068)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_230868175 = PyInt_FromLong(230868175L); if (unlikely(!__pyx_int_230868175)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_239616695 = PyInt_FromLong(239616695L); if (unlikely(!__pyx_int_239616695)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_6pyross_9inference_SIR_type = &__pyx_vtable_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_SIR_type._get_r_from_x = (PyArrayObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *))__pyx_f_6pyross_9inference_8SIR_type__get_r_from_x;
  __pyx_vtable_6pyross_9inference_SIR_type._penalty_from_negative_values = (double (*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *))__pyx_f_6pyross_9inference_8SIR_type__penalty_from_negative_values;
  __pyx_vtable_6pyross_9inference_SIR_type.find_fastest_growing_lin_mode = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, double, int __pyx_skip_dispatch))__pyx_f_6pyross_9inference_8SIR_type_find_fastest_growing_lin_mode;
  __pyx_vtable_6pyross_9inference_SIR_type._obtain_logp_for_traj = (double (*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_traj *__pyx_optional_args))__pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_traj;
  __pyx_vtable_6pyross_9inference_SIR_type._obtain_logp_for_lat_traj = (double (*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, __Pyx_memviewslice, PyArrayObject *, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj *__pyx_optional_args))__pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_lat_traj;
  __pyx_vtable_6pyross_9inference_SIR_type._obtain_logp_for_traj_tangent = (double (*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double))__pyx_f_6pyross_9inference_8SIR_type__obtain_logp_for_traj_tangent;
  __pyx_vtable_6pyross_9inference_SIR_type._log_cond_p = (double (*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_8SIR_type__log_cond_p;
  __pyx_vtable_6pyross_9inference_SIR_type._estimate_cond_cov = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, double, double))__pyx_f_6pyross_9inference_8SIR_type__estimate_cond_cov;
  __pyx_vtable_6pyross_9inference_SIR_type.obtain_full_mean_cov = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov *__pyx_optional_args))__pyx_f_6pyross_9inference_8SIR_type_obtain_full_mean_cov;
  __pyx_vtable_6pyross_9inference_SIR_type.interpolate_euler = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pyross_9inference_8SIR_type_interpolate_euler;
  __pyx_vtable_6pyross_9inference_SIR_type.obtain_full_mean_cov_tangent_space = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space *__pyx_optional_args))__pyx_f_6pyross_9inference_8SIR_type_obtain_full_mean_cov_tangent_space;
  __pyx_vtable_6pyross_9inference_SIR_type._rhs0 = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pyross_9inference_8SIR_type__rhs0;
  __pyx_vtable_6pyross_9inference_SIR_type._obtain_time_evol_op_2 = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyObject *, double, double, int __pyx_skip_dispatch))__pyx_f_6pyross_9inference_8SIR_type__obtain_time_evol_op_2;
  __pyx_vtable_6pyross_9inference_SIR_type._compute_dsigdt = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice))__pyx_f_6pyross_9inference_8SIR_type__compute_dsigdt;
  __pyx_vtable_6pyross_9inference_SIR_type.convert_vec_to_mat = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, int __pyx_skip_dispatch))__pyx_f_6pyross_9inference_8SIR_type_convert_vec_to_mat;
  __pyx_vtable_6pyross_9inference_SIR_type.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SIR_type) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SIR_type.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SIR_type.tp_dictoffset && __pyx_type_6pyross_9inference_SIR_type.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SIR_type.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SIR_type.tp_dict, __pyx_vtabptr_6pyross_9inference_SIR_type) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SIR_type, (PyObject *)&__pyx_type_6pyross_9inference_SIR_type) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SIR_type) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SIR_type = &__pyx_type_6pyross_9inference_SIR_type;
  __pyx_vtabptr_6pyross_9inference_SIR = &__pyx_vtable_6pyross_9inference_SIR;
  __pyx_vtable_6pyross_9inference_SIR.__pyx_base = *__pyx_vtabptr_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_SIR.__pyx_base.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_3SIR_compute_jacobian_and_b_matrix;
  __pyx_vtable_6pyross_9inference_SIR.fill_lambdas = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3SIR_fill_lambdas;
  __pyx_vtable_6pyross_9inference_SIR.jacobian = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3SIR_jacobian;
  __pyx_vtable_6pyross_9inference_SIR.noise_correlation = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3SIR_noise_correlation;
  __pyx_type_6pyross_9inference_SIR.tp_base = __pyx_ptype_6pyross_9inference_SIR_type;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SIR) < 0) __PYX_ERR(0, 3628, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SIR.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SIR.tp_dictoffset && __pyx_type_6pyross_9inference_SIR.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SIR.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SIR.tp_dict, __pyx_vtabptr_6pyross_9inference_SIR) < 0) __PYX_ERR(0, 3628, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SIR, (PyObject *)&__pyx_type_6pyross_9inference_SIR) < 0) __PYX_ERR(0, 3628, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SIR) < 0) __PYX_ERR(0, 3628, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SIR = &__pyx_type_6pyross_9inference_SIR;
  __pyx_vtabptr_6pyross_9inference_SEIR = &__pyx_vtable_6pyross_9inference_SEIR;
  __pyx_vtable_6pyross_9inference_SEIR.__pyx_base = *__pyx_vtabptr_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_SEIR.__pyx_base.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_4SEIR_compute_jacobian_and_b_matrix;
  __pyx_vtable_6pyross_9inference_SEIR.fill_lambdas = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_4SEIR_fill_lambdas;
  __pyx_vtable_6pyross_9inference_SEIR.jacobian = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEIR *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_4SEIR_jacobian;
  __pyx_vtable_6pyross_9inference_SEIR.noise_correlation = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEIR *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_4SEIR_noise_correlation;
  __pyx_type_6pyross_9inference_SEIR.tp_base = __pyx_ptype_6pyross_9inference_SIR_type;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SEIR) < 0) __PYX_ERR(0, 3758, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SEIR.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SEIR.tp_dictoffset && __pyx_type_6pyross_9inference_SEIR.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SEIR.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SEIR.tp_dict, __pyx_vtabptr_6pyross_9inference_SEIR) < 0) __PYX_ERR(0, 3758, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SEIR, (PyObject *)&__pyx_type_6pyross_9inference_SEIR) < 0) __PYX_ERR(0, 3758, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SEIR) < 0) __PYX_ERR(0, 3758, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SEIR = &__pyx_type_6pyross_9inference_SEIR;
  __pyx_vtabptr_6pyross_9inference_SEAIRQ = &__pyx_vtable_6pyross_9inference_SEAIRQ;
  __pyx_vtable_6pyross_9inference_SEAIRQ.__pyx_base = *__pyx_vtabptr_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_SEAIRQ.__pyx_base.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_6SEAIRQ_compute_jacobian_and_b_matrix;
  __pyx_vtable_6pyross_9inference_SEAIRQ.fill_lambdas = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEAIRQ *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_6SEAIRQ_fill_lambdas;
  __pyx_vtable_6pyross_9inference_SEAIRQ.jacobian = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEAIRQ *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_6SEAIRQ_jacobian;
  __pyx_vtable_6pyross_9inference_SEAIRQ.noise_correlation = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEAIRQ *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_6SEAIRQ_noise_correlation;
  __pyx_type_6pyross_9inference_SEAIRQ.tp_base = __pyx_ptype_6pyross_9inference_SIR_type;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SEAIRQ) < 0) __PYX_ERR(0, 3901, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SEAIRQ.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SEAIRQ.tp_dictoffset && __pyx_type_6pyross_9inference_SEAIRQ.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SEAIRQ.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SEAIRQ.tp_dict, __pyx_vtabptr_6pyross_9inference_SEAIRQ) < 0) __PYX_ERR(0, 3901, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SEAIRQ, (PyObject *)&__pyx_type_6pyross_9inference_SEAIRQ) < 0) __PYX_ERR(0, 3901, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SEAIRQ) < 0) __PYX_ERR(0, 3901, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SEAIRQ = &__pyx_type_6pyross_9inference_SEAIRQ;
  __pyx_vtabptr_6pyross_9inference_SEAIRQ_testing = &__pyx_vtable_6pyross_9inference_SEAIRQ_testing;
  __pyx_vtable_6pyross_9inference_SEAIRQ_testing.__pyx_base = *__pyx_vtabptr_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_SEAIRQ_testing.__pyx_base.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_14SEAIRQ_testing_compute_jacobian_and_b_matrix;
  __pyx_vtable_6pyross_9inference_SEAIRQ_testing.fill_lambdas = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_14SEAIRQ_testing_fill_lambdas;
  __pyx_vtable_6pyross_9inference_SEAIRQ_testing.jacobian = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_14SEAIRQ_testing_jacobian;
  __pyx_vtable_6pyross_9inference_SEAIRQ_testing.noise_correlation = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SEAIRQ_testing *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_14SEAIRQ_testing_noise_correlation;
  __pyx_type_6pyross_9inference_SEAIRQ_testing.tp_base = __pyx_ptype_6pyross_9inference_SIR_type;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SEAIRQ_testing) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SEAIRQ_testing.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SEAIRQ_testing.tp_dictoffset && __pyx_type_6pyross_9inference_SEAIRQ_testing.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SEAIRQ_testing.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SEAIRQ_testing.tp_dict, __pyx_vtabptr_6pyross_9inference_SEAIRQ_testing) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SEAIRQ_testing, (PyObject *)&__pyx_type_6pyross_9inference_SEAIRQ_testing) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SEAIRQ_testing) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SEAIRQ_testing = &__pyx_type_6pyross_9inference_SEAIRQ_testing;
  __pyx_vtabptr_6pyross_9inference_Spp = &__pyx_vtable_6pyross_9inference_Spp;
  __pyx_vtable_6pyross_9inference_Spp.__pyx_base = *__pyx_vtabptr_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_Spp.__pyx_base._get_r_from_x = (PyArrayObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *))__pyx_f_6pyross_9inference_3Spp__get_r_from_x;
  __pyx_vtable_6pyross_9inference_Spp.__pyx_base.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_3Spp_compute_jacobian_and_b_matrix;
  __pyx_vtable_6pyross_9inference_Spp.fill_lambdas = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3Spp_fill_lambdas;
  __pyx_vtable_6pyross_9inference_Spp.fill_finres_pop = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3Spp_fill_finres_pop;
  __pyx_vtable_6pyross_9inference_Spp.jacobian = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3Spp_jacobian;
  __pyx_vtable_6pyross_9inference_Spp.noise_correlation = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_Spp *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_3Spp_noise_correlation;
  __pyx_type_6pyross_9inference_Spp.tp_base = __pyx_ptype_6pyross_9inference_SIR_type;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_Spp) < 0) __PYX_ERR(0, 4310, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_Spp.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_Spp.tp_dictoffset && __pyx_type_6pyross_9inference_Spp.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_Spp.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_Spp.tp_dict, __pyx_vtabptr_6pyross_9inference_Spp) < 0) __PYX_ERR(0, 4310, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Spp, (PyObject *)&__pyx_type_6pyross_9inference_Spp) < 0) __PYX_ERR(0, 4310, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_Spp) < 0) __PYX_ERR(0, 4310, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_Spp = &__pyx_type_6pyross_9inference_Spp;
  __pyx_vtabptr_6pyross_9inference_SppQ = &__pyx_vtable_6pyross_9inference_SppQ;
  __pyx_vtable_6pyross_9inference_SppQ.__pyx_base = *__pyx_vtabptr_6pyross_9inference_Spp;
  __pyx_vtable_6pyross_9inference_SppQ.full_time_dep_param_mapping = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SppQ *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pyross_9inference_4SppQ_full_time_dep_param_mapping;
  __pyx_type_6pyross_9inference_SppQ.tp_base = __pyx_ptype_6pyross_9inference_Spp;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SppQ) < 0) __PYX_ERR(0, 4739, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SppQ.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SppQ.tp_dictoffset && __pyx_type_6pyross_9inference_SppQ.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SppQ.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SppQ.tp_dict, __pyx_vtabptr_6pyross_9inference_SppQ) < 0) __PYX_ERR(0, 4739, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SppQ, (PyObject *)&__pyx_type_6pyross_9inference_SppQ) < 0) __PYX_ERR(0, 4739, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SppQ) < 0) __PYX_ERR(0, 4739, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SppQ = &__pyx_type_6pyross_9inference_SppQ;
  __pyx_vtabptr_6pyross_9inference_SppQ_old = &__pyx_vtable_6pyross_9inference_SppQ_old;
  __pyx_vtable_6pyross_9inference_SppQ_old.__pyx_base = *__pyx_vtabptr_6pyross_9inference_SIR_type;
  __pyx_vtable_6pyross_9inference_SppQ_old.__pyx_base._get_r_from_x = (PyArrayObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *))__pyx_f_6pyross_9inference_8SppQ_old__get_r_from_x;
  __pyx_vtable_6pyross_9inference_SppQ_old.__pyx_base._penalty_from_negative_values = (double (*)(struct __pyx_obj_6pyross_9inference_SIR_type *, PyArrayObject *))__pyx_f_6pyross_9inference_8SppQ_old__penalty_from_negative_values;
  __pyx_vtable_6pyross_9inference_SppQ_old.__pyx_base.compute_jacobian_and_b_matrix = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SIR_type *, __Pyx_memviewslice, double, struct __pyx_opt_args_6pyross_9inference_8SIR_type_compute_jacobian_and_b_matrix *__pyx_optional_args))__pyx_f_6pyross_9inference_8SppQ_old_compute_jacobian_and_b_matrix;
  __pyx_vtable_6pyross_9inference_SppQ_old._get_rq_from_x = (PyArrayObject *(*)(struct __pyx_obj_6pyross_9inference_SppQ_old *, PyArrayObject *))__pyx_f_6pyross_9inference_8SppQ_old__get_rq_from_x;
  __pyx_vtable_6pyross_9inference_SppQ_old.calculate_test_r = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice, double))__pyx_f_6pyross_9inference_8SppQ_old_calculate_test_r;
  __pyx_vtable_6pyross_9inference_SppQ_old.fill_lambdas = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice))__pyx_f_6pyross_9inference_8SppQ_old_fill_lambdas;
  __pyx_vtable_6pyross_9inference_SppQ_old.jacobian = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, double, double))__pyx_f_6pyross_9inference_8SppQ_old_jacobian;
  __pyx_vtable_6pyross_9inference_SppQ_old.noise_correlation = (PyObject *(*)(struct __pyx_obj_6pyross_9inference_SppQ_old *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, double))__pyx_f_6pyross_9inference_8SppQ_old_noise_correlation;
  __pyx_type_6pyross_9inference_SppQ_old.tp_base = __pyx_ptype_6pyross_9inference_SIR_type;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SppQ_old) < 0) __PYX_ERR(0, 4847, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SppQ_old.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SppQ_old.tp_dictoffset && __pyx_type_6pyross_9inference_SppQ_old.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SppQ_old.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SppQ_old.tp_dict, __pyx_vtabptr_6pyross_9inference_SppQ_old) < 0) __PYX_ERR(0, 4847, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SppQ_old, (PyObject *)&__pyx_type_6pyross_9inference_SppQ_old) < 0) __PYX_ERR(0, 4847, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SppQ_old) < 0) __PYX_ERR(0, 4847, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SppQ_old = &__pyx_type_6pyross_9inference_SppQ_old;
  __pyx_vtabptr_6pyross_9inference_SppSparse = &__pyx_vtable_6pyross_9inference_SppSparse;
  __pyx_vtable_6pyross_9inference_SppSparse.__pyx_base = *__pyx_vtabptr_6pyross_9inference_Spp;
  __pyx_type_6pyross_9inference_SppSparse.tp_base = __pyx_ptype_6pyross_9inference_Spp;
  if (PyType_Ready(&__pyx_type_6pyross_9inference_SppSparse) < 0) __PYX_ERR(0, 5232, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference_SppSparse.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference_SppSparse.tp_dictoffset && __pyx_type_6pyross_9inference_SppSparse.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference_SppSparse.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6pyross_9inference_SppSparse.tp_dict, __pyx_vtabptr_6pyross_9inference_SppSparse) < 0) __PYX_ERR(0, 5232, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SppSparse, (PyObject *)&__pyx_type_6pyross_9inference_SppSparse) < 0) __PYX_ERR(0, 5232, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pyross_9inference_SppSparse) < 0) __PYX_ERR(0, 5232, __pyx_L1_error)
  __pyx_ptype_6pyross_9inference_SppSparse = &__pyx_type_6pyross_9inference_SppSparse;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct__FIM) < 0) __PYX_ERR(0, 945, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct__FIM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct__FIM.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct__FIM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct__FIM.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct__FIM = &__pyx_type_6pyross_9inference___pyx_scope_struct__FIM;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det) < 0) __PYX_ERR(0, 1051, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_1_FIM_det = &__pyx_type_6pyross_9inference___pyx_scope_struct_1_FIM_det;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian) < 0) __PYX_ERR(0, 1147, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_2_hessian = &__pyx_type_6pyross_9inference___pyx_scope_struct_2_hessian;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness) < 0) __PYX_ERR(0, 1216, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_3_robustness = &__pyx_type_6pyross_9inference___pyx_scope_struct_3_robustness;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM) < 0) __PYX_ERR(0, 2537, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_4_latent_FIM = &__pyx_type_6pyross_9inference___pyx_scope_struct_4_latent_FIM;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det) < 0) __PYX_ERR(0, 2652, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det = &__pyx_type_6pyross_9inference___pyx_scope_struct_5_latent_FIM_det;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian) < 0) __PYX_ERR(0, 2757, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_6_latent_hessian = &__pyx_type_6pyross_9inference___pyx_scope_struct_6_latent_hessian;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov) < 0) __PYX_ERR(0, 3388, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov = &__pyx_type_6pyross_9inference___pyx_scope_struct_7__estimate_cond_cov;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op) < 0) __PYX_ERR(0, 3511, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op = &__pyx_type_6pyross_9inference___pyx_scope_struct_8__obtain_time_evol_op;
  if (PyType_Ready(&__pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate) < 0) __PYX_ERR(0, 3583, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate.tp_dictoffset && __pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6pyross_9inference___pyx_scope_struct_9_integrate = &__pyx_type_6pyross_9inference___pyx_scope_struct_9_integrate;
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_array.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
  __pyx_array_type = &__pyx_type___pyx_array;
  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_MemviewEnum.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_memoryview.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_memoryviewslice.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pyross.deterministic"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_6pyross_13deterministic_CommonMethods = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "CommonMethods", sizeof(struct __pyx_obj_6pyross_13deterministic_CommonMethods), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_CommonMethods) __PYX_ERR(4, 7, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_CommonMethods = (struct __pyx_vtabstruct_6pyross_13deterministic_CommonMethods*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_CommonMethods->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_CommonMethods)) __PYX_ERR(4, 7, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SIR = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SIR", sizeof(struct __pyx_obj_6pyross_13deterministic_SIR), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SIR) __PYX_ERR(4, 25, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SIR = (struct __pyx_vtabstruct_6pyross_13deterministic_SIR*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SIR->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SIR)) __PYX_ERR(4, 25, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SIRS = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SIRS", sizeof(struct __pyx_obj_6pyross_13deterministic_SIRS), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SIRS) __PYX_ERR(4, 45, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SIRS = (struct __pyx_vtabstruct_6pyross_13deterministic_SIRS*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SIRS->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SIRS)) __PYX_ERR(4, 45, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEIR = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEIR", sizeof(struct __pyx_obj_6pyross_13deterministic_SEIR), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEIR) __PYX_ERR(4, 63, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEIR = (struct __pyx_vtabstruct_6pyross_13deterministic_SEIR*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEIR->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEIR)) __PYX_ERR(4, 63, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEI8R = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEI8R", sizeof(struct __pyx_obj_6pyross_13deterministic_SEI8R), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEI8R) __PYX_ERR(4, 78, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEI8R = (struct __pyx_vtabstruct_6pyross_13deterministic_SEI8R*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEI8R->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEI8R)) __PYX_ERR(4, 78, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SIkR = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SIkR", sizeof(struct __pyx_obj_6pyross_13deterministic_SIkR), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SIkR) __PYX_ERR(4, 110, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SIkR = (struct __pyx_vtabstruct_6pyross_13deterministic_SIkR*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SIkR->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SIkR)) __PYX_ERR(4, 110, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEkIkR = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEkIkR", sizeof(struct __pyx_obj_6pyross_13deterministic_SEkIkR), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEkIkR) __PYX_ERR(4, 125, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEkIkR = (struct __pyx_vtabstruct_6pyross_13deterministic_SEkIkR*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEkIkR->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEkIkR)) __PYX_ERR(4, 125, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEkIkIkR = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEkIkIkR", sizeof(struct __pyx_obj_6pyross_13deterministic_SEkIkIkR), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEkIkIkR) __PYX_ERR(4, 142, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEkIkIkR = (struct __pyx_vtabstruct_6pyross_13deterministic_SEkIkIkR*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEkIkIkR->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEkIkIkR)) __PYX_ERR(4, 142, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEAIR = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEAIR", sizeof(struct __pyx_obj_6pyross_13deterministic_SEAIR), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEAIR) __PYX_ERR(4, 159, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEAIR = (struct __pyx_vtabstruct_6pyross_13deterministic_SEAIR*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEAIR->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEAIR)) __PYX_ERR(4, 159, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEAI8R = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEAI8R", sizeof(struct __pyx_obj_6pyross_13deterministic_SEAI8R), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEAI8R) __PYX_ERR(4, 179, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEAI8R = (struct __pyx_vtabstruct_6pyross_13deterministic_SEAI8R*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEAI8R->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEAI8R)) __PYX_ERR(4, 179, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEAIRQ = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEAIRQ", sizeof(struct __pyx_obj_6pyross_13deterministic_SEAIRQ), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEAIRQ) __PYX_ERR(4, 210, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEAIRQ = (struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEAIRQ->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEAIRQ)) __PYX_ERR(4, 210, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEAIRQ_testing = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEAIRQ_testing", sizeof(struct __pyx_obj_6pyross_13deterministic_SEAIRQ_testing), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEAIRQ_testing) __PYX_ERR(4, 234, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEAIRQ_testing = (struct __pyx_vtabstruct_6pyross_13deterministic_SEAIRQ_testing*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEAIRQ_testing->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEAIRQ_testing)) __PYX_ERR(4, 234, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_Spp = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "Spp", sizeof(struct __pyx_obj_6pyross_13deterministic_Spp), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_Spp) __PYX_ERR(4, 260, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_Spp = (struct __pyx_vtabstruct_6pyross_13deterministic_Spp*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_Spp->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_Spp)) __PYX_ERR(4, 260, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SppSparse = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SppSparse", sizeof(struct __pyx_obj_6pyross_13deterministic_SppSparse), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SppSparse) __PYX_ERR(4, 284, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SppSparse = (struct __pyx_vtabstruct_6pyross_13deterministic_SppSparse*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SppSparse->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SppSparse)) __PYX_ERR(4, 284, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SppQ = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SppQ", sizeof(struct __pyx_obj_6pyross_13deterministic_SppQ), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SppQ) __PYX_ERR(4, 298, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SppQ = (struct __pyx_vtabstruct_6pyross_13deterministic_SppQ*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SppQ->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SppQ)) __PYX_ERR(4, 298, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SppQ_old = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SppQ_old", sizeof(struct __pyx_obj_6pyross_13deterministic_SppQ_old), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SppQ_old) __PYX_ERR(4, 316, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SppQ_old = (struct __pyx_vtabstruct_6pyross_13deterministic_SppQ_old*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SppQ_old->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SppQ_old)) __PYX_ERR(4, 316, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEI5R = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEI5R", sizeof(struct __pyx_obj_6pyross_13deterministic_SEI5R), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEI5R) __PYX_ERR(4, 342, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEI5R = (struct __pyx_vtabstruct_6pyross_13deterministic_SEI5R*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEI5R->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEI5R)) __PYX_ERR(4, 342, __pyx_L1_error)
  __pyx_ptype_6pyross_13deterministic_SEAI5R = __Pyx_ImportType(__pyx_t_1, "pyross.deterministic", "SEAI5R", sizeof(struct __pyx_obj_6pyross_13deterministic_SEAI5R), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_6pyross_13deterministic_SEAI5R) __PYX_ERR(4, 363, __pyx_L1_error)
  __pyx_vtabptr_6pyross_13deterministic_SEAI5R = (struct __pyx_vtabstruct_6pyross_13deterministic_SEAI5R*)__Pyx_GetVtable(__pyx_ptype_6pyross_13deterministic_SEAI5R->tp_dict); if (unlikely(!__pyx_vtabptr_6pyross_13deterministic_SEAI5R)) __PYX_ERR(4, 363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initinference(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initinference(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_inference(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_inference(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
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) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_inference(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  static PyThread_type_lock __pyx_t_8[8];
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'inference' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_inference(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("inference", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_pyross__inference) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "pyross.inference")) {
      if (unlikely(PyDict_SetItemString(modules, "pyross.inference", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "pyross/inference.pyx":1
 * from itertools import compress             # <<<<<<<<<<<<<<
 * from scipy import sparse
 * from scipy.integrate import solve_ivp, quad
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_compress);
  __Pyx_GIVEREF(__pyx_n_s_compress);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_compress);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_compress); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":2
 * from itertools import compress
 * from scipy import sparse             # <<<<<<<<<<<<<<
 * from scipy.integrate import solve_ivp, quad
 * from scipy.optimize import minimize, approx_fprime
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_sparse);
  __Pyx_GIVEREF(__pyx_n_s_sparse);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_sparse);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_sparse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparse, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":3
 * from itertools import compress
 * from scipy import sparse
 * from scipy.integrate import solve_ivp, quad             # <<<<<<<<<<<<<<
 * from scipy.optimize import minimize, approx_fprime
 * from scipy.stats import lognorm
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_solve_ivp);
  __Pyx_GIVEREF(__pyx_n_s_solve_ivp);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_solve_ivp);
  __Pyx_INCREF(__pyx_n_s_quad);
  __Pyx_GIVEREF(__pyx_n_s_quad);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_quad);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_integrate, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_solve_ivp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_solve_ivp, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_quad); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_quad, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":4
 * from scipy import sparse
 * from scipy.integrate import solve_ivp, quad
 * from scipy.optimize import minimize, approx_fprime             # <<<<<<<<<<<<<<
 * from scipy.stats import lognorm
 * from scipy.linalg import solve_triangular, rq
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_minimize);
  __Pyx_GIVEREF(__pyx_n_s_minimize);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_minimize);
  __Pyx_INCREF(__pyx_n_s_approx_fprime);
  __Pyx_GIVEREF(__pyx_n_s_approx_fprime);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_approx_fprime);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_optimize, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_minimize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_minimize, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_approx_fprime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_approx_fprime, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":5
 * from scipy.integrate import solve_ivp, quad
 * from scipy.optimize import minimize, approx_fprime
 * from scipy.stats import lognorm             # <<<<<<<<<<<<<<
 * from scipy.linalg import solve_triangular, rq
 * import numpy as np
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_lognorm);
  __Pyx_GIVEREF(__pyx_n_s_lognorm);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_lognorm);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_stats, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_lognorm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lognorm, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":6
 * from scipy.optimize import minimize, approx_fprime
 * from scipy.stats import lognorm
 * from scipy.linalg import solve_triangular, rq             # <<<<<<<<<<<<<<
 * import numpy as np
 * from scipy.interpolate import make_interp_spline
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_solve_triangular);
  __Pyx_GIVEREF(__pyx_n_s_solve_triangular);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_solve_triangular);
  __Pyx_INCREF(__pyx_n_s_rq);
  __Pyx_GIVEREF(__pyx_n_s_rq);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_rq);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_linalg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_solve_triangular); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_solve_triangular, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_rq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rq, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":7
 * from scipy.stats import lognorm
 * from scipy.linalg import solve_triangular, rq
 * import numpy as np             # <<<<<<<<<<<<<<
 * from scipy.interpolate import make_interp_spline
 * from scipy.linalg import eig
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":8
 * from scipy.linalg import solve_triangular, rq
 * import numpy as np
 * from scipy.interpolate import make_interp_spline             # <<<<<<<<<<<<<<
 * from scipy.linalg import eig
 * cimport numpy as np
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_make_interp_spline);
  __Pyx_GIVEREF(__pyx_n_s_make_interp_spline);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_make_interp_spline);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_interpolate, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_make_interp_spline); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_interp_spline, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":9
 * import numpy as np
 * from scipy.interpolate import make_interp_spline
 * from scipy.linalg import eig             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * cimport cython
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_eig);
  __Pyx_GIVEREF(__pyx_n_s_eig);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_eig);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_linalg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_eig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_eig, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":12
 * cimport numpy as np
 * cimport cython
 * from math import isclose             # <<<<<<<<<<<<<<
 * import time, sympy
 * from sympy import MutableDenseNDimArray as Array
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_isclose);
  __Pyx_GIVEREF(__pyx_n_s_isclose);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_isclose);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_isclose); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_isclose, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":13
 * cimport cython
 * from math import isclose
 * import time, sympy             # <<<<<<<<<<<<<<
 * from sympy import MutableDenseNDimArray as Array
 * from sympy import Inverse, tensorcontraction, tensorproduct, permutedims
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sympy, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sympy, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":14
 * from math import isclose
 * import time, sympy
 * from sympy import MutableDenseNDimArray as Array             # <<<<<<<<<<<<<<
 * from sympy import Inverse, tensorcontraction, tensorproduct, permutedims
 * from scipy import interpolate
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_MutableDenseNDimArray);
  __Pyx_GIVEREF(__pyx_n_s_MutableDenseNDimArray);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_MutableDenseNDimArray);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sympy, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_MutableDenseNDimArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Array, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":15
 * import time, sympy
 * from sympy import MutableDenseNDimArray as Array
 * from sympy import Inverse, tensorcontraction, tensorproduct, permutedims             # <<<<<<<<<<<<<<
 * from scipy import interpolate
 * import dill
 */
  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Inverse);
  __Pyx_GIVEREF(__pyx_n_s_Inverse);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Inverse);
  __Pyx_INCREF(__pyx_n_s_tensorcontraction);
  __Pyx_GIVEREF(__pyx_n_s_tensorcontraction);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_tensorcontraction);
  __Pyx_INCREF(__pyx_n_s_tensorproduct);
  __Pyx_GIVEREF(__pyx_n_s_tensorproduct);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_tensorproduct);
  __Pyx_INCREF(__pyx_n_s_permutedims);
  __Pyx_GIVEREF(__pyx_n_s_permutedims);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_permutedims);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sympy, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Inverse); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Inverse, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_tensorcontraction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tensorcontraction, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_tensorproduct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tensorproduct, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_permutedims); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_permutedims, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyross/inference.pyx":16
 * from sympy import MutableDenseNDimArray as Array
 * from sympy import Inverse, tensorcontraction, tensorproduct, permutedims
 * from scipy import interpolate             # <<<<<<<<<<<<<<
 * import dill
 * import hashlib
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_interpolate);
  __Pyx_GIVEREF(__pyx_n_s_interpolate);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_interpolate);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_interpolate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_interpolate, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":17
 * from sympy import Inverse, tensorcontraction, tensorproduct, permutedims
 * from scipy import interpolate
 * import dill             # <<<<<<<<<<<<<<
 * import hashlib
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_dill, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dill, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":18
 * from scipy import interpolate
 * import dill
 * import hashlib             # <<<<<<<<<<<<<<
 * 
 * try:
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_hashlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":20
 * import hashlib
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for nested sampling.
 *     import dynesty
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "pyross/inference.pyx":22
 * try:
 *     # Optional support for nested sampling.
 *     import dynesty             # <<<<<<<<<<<<<<
 * except ImportError:
 *     dynesty = None
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_dynesty, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_dynesty, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyross/inference.pyx":20
 * import hashlib
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for nested sampling.
 *     import dynesty
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyross/inference.pyx":23
 *     # Optional support for nested sampling.
 *     import dynesty
 * except ImportError:             # <<<<<<<<<<<<<<
 *     dynesty = None
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("pyross.inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_7) < 0) __PYX_ERR(0, 23, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pyross/inference.pyx":24
 *     import dynesty
 * except ImportError:
 *     dynesty = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_dynesty, Py_None) < 0) __PYX_ERR(0, 24, __pyx_L4_except_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;

    /* "pyross/inference.pyx":20
 * import hashlib
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for nested sampling.
 *     import dynesty
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L7_try_end:;
  }

  /* "pyross/inference.pyx":26
 *     dynesty = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for MCMC sampling.
 *     import emcee
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "pyross/inference.pyx":28
 * try:
 *     # Optional support for MCMC sampling.
 *     import emcee             # <<<<<<<<<<<<<<
 * except ImportError:
 *     emcee = None
 */
      __pyx_t_7 = __Pyx_Import(__pyx_n_s_emcee, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 28, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_emcee, __pyx_t_7) < 0) __PYX_ERR(0, 28, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyross/inference.pyx":26
 *     dynesty = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for MCMC sampling.
 *     import emcee
 */
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L15_try_end;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":29
 *     # Optional support for MCMC sampling.
 *     import emcee
 * except ImportError:             # <<<<<<<<<<<<<<
 *     emcee = None
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("pyross.inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L12_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyross/inference.pyx":30
 *     import emcee
 * except ImportError:
 *     emcee = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_emcee, Py_None) < 0) __PYX_ERR(0, 30, __pyx_L12_except_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L11_exception_handled;
    }
    goto __pyx_L12_except_error;
    __pyx_L12_except_error:;

    /* "pyross/inference.pyx":26
 *     dynesty = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for MCMC sampling.
 *     import emcee
 */
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L11_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    __pyx_L15_try_end:;
  }

  /* "pyross/inference.pyx":32
 *     emcee = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for multiprocessing in the minimization function.
 *     import pathos.multiprocessing as pathos_mp
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "pyross/inference.pyx":34
 * try:
 *     # Optional support for multiprocessing in the minimization function.
 *     import pathos.multiprocessing as pathos_mp             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pathos_mp = None
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s__75);
      __Pyx_GIVEREF(__pyx_n_s__75);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__75);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_pathos_multiprocessing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathos_mp, __pyx_t_2) < 0) __PYX_ERR(0, 34, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyross/inference.pyx":32
 *     emcee = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for multiprocessing in the minimization function.
 *     import pathos.multiprocessing as pathos_mp
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L23_try_end;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyross/inference.pyx":35
 *     # Optional support for multiprocessing in the minimization function.
 *     import pathos.multiprocessing as pathos_mp
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pathos_mp = None
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("pyross.inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 35, __pyx_L20_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pyross/inference.pyx":36
 *     import pathos.multiprocessing as pathos_mp
 * except ImportError:
 *     pathos_mp = None             # <<<<<<<<<<<<<<
 * 
 * import pyross.deterministic
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathos_mp, Py_None) < 0) __PYX_ERR(0, 36, __pyx_L20_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L19_exception_handled;
    }
    goto __pyx_L20_except_error;
    __pyx_L20_except_error:;

    /* "pyross/inference.pyx":32
 *     emcee = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     # Optional support for multiprocessing in the minimization function.
 *     import pathos.multiprocessing as pathos_mp
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L19_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L23_try_end:;
  }

  /* "pyross/inference.pyx":38
 *     pathos_mp = None
 * 
 * import pyross.deterministic             # <<<<<<<<<<<<<<
 * cimport pyross.deterministic
 * import pyross.contactMatrix
 */
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_pyross_deterministic, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyross, __pyx_t_7) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":40
 * import pyross.deterministic
 * cimport pyross.deterministic
 * import pyross.contactMatrix             # <<<<<<<<<<<<<<
 * from pyross.utils_python import *
 * from libc.math cimport sqrt, log, INFINITY
 */
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_pyross_contactMatrix, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyross, __pyx_t_7) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":41
 * cimport pyross.deterministic
 * import pyross.contactMatrix
 * from pyross.utils_python import *             # <<<<<<<<<<<<<<
 * from libc.math cimport sqrt, log, INFINITY
 * cdef double PI = 3.14159265359
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s__75);
  __Pyx_GIVEREF(__pyx_n_s__75);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s__75);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pyross_utils_python, __pyx_t_7, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_import_star(__pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyross/inference.pyx":43
 * from pyross.utils_python import *
 * from libc.math cimport sqrt, log, INFINITY
 * cdef double PI = 3.14159265359             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_6pyross_9inference_PI = 3.14159265359;

  /* "pyross/inference.pyx":46
 * 
 * 
 * DTYPE   = np.float             # <<<<<<<<<<<<<<
 * ctypedef np.float_t DTYPE_t
 * ctypedef np.uint8_t BOOL_t
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_7) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SIR_type(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_1__pyx_unpickle_SIR_type, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SIR_type, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_SIR_type__set_state(<SIR_type> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SIR_type__set_state(SIR_type __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.dim = __pyx_state[16]; __pyx_result.dsigmadt = __pyx_state[17]; __pyx_result.fi = __pyx_state[18]; __pyx_result.flat_indices = __pyx_state[19]; __pyx_result.flat_indices1 = __pyx_state[20]; __pyx_result.flat_indices2 = __pyx_state[21]; __pyx_result.fsa = __pyx_state[22]; __pyx_result.gIa = __pyx_state[23]; __pyx_result.gIs = __pyx_state[24]; __pyx_result.lyapunov_method = __pyx_state[25]; __pyx_result.nClass = __pyx_state[26]; __pyx_result.param_keys = __pyx_state[27]; __pyx_result.param_mapping_enabled = __pyx_state[28]; __pyx_result.rows = __pyx_state[29]; __pyx_result.rtol_det = __pyx_state[30]; __pyx_result.rtol_lyapunov = __pyx_state[31]; __pyx_result.steps = __pyx_state[32]; __pyx_result.vec_size = __pyx_state[33]
 *     if len(__pyx_state) > 34 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_3__pyx_unpickle_SIR, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SIR, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SEIR(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_5__pyx_unpickle_SEIR, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SEIR, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_SEIR__set_state(<SEIR> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEIR__set_state(SEIR __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.contactMatrix = __pyx_state[14]; __pyx_result.det_method = __pyx_state[15]; __pyx_result.det_model = __pyx_state[16]; __pyx_result.dim = __pyx_state[17]; __pyx_result.dsigmadt = __pyx_state[18]; __pyx_result.fi = __pyx_state[19]; __pyx_result.flat_indices = __pyx_state[20]; __pyx_result.flat_indices1 = __pyx_state[21]; __pyx_result.flat_indices2 = __pyx_state[22]; __pyx_result.fsa = __pyx_state[23]; __pyx_result.gE = __pyx_state[24]; __pyx_result.gIa = __pyx_state[25]; __pyx_result.gIs = __pyx_state[26]; __pyx_result.lyapunov_method = __pyx_state[27]; __pyx_result.nClass = __pyx_state[28]; __pyx_result.param_keys = __pyx_state[29]; __pyx_result.param_mapping_enabled = __pyx_state[30]; __pyx_result.rows = __pyx_state[31]; __pyx_result.rtol_det = __pyx_state[32]; __pyx_result.rtol_lyapunov = __pyx_state[33]; __pyx_result.steps = __pyx_state[34]; __pyx_result.vec_size = __pyx_state[35]
 *     if len(__pyx_state) > 36 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_7__pyx_unpickle_SEAIRQ, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SEAIRQ, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SEAIRQ_testing(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_9__pyx_unpickle_SEAIRQ_testing, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SEAIRQ_testing, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_SEAIRQ_testing__set_state(<SEAIRQ_testing> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SEAIRQ_testing__set_state(SEAIRQ_testing __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.ars = __pyx_state[11]; __pyx_result.beta = __pyx_state[12]; __pyx_result.class_index_dict = __pyx_state[13]; __pyx_result.cols = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.flat_indices = __pyx_state[21]; __pyx_result.flat_indices1 = __pyx_state[22]; __pyx_result.flat_indices2 = __pyx_state[23]; __pyx_result.fsa = __pyx_state[24]; __pyx_result.gA = __pyx_state[25]; __pyx_result.gE = __pyx_state[26]; __pyx_result.gIa = __pyx_state[27]; __pyx_result.gIs = __pyx_state[28]; __pyx_result.kapE = __pyx_state[29]; __pyx_result.lyapunov_method = __pyx_state[30]; __pyx_result.nClass = __pyx_state[31]; __pyx_result.param_keys = __pyx_state[32]; __pyx_result.param_mapping_enabled = __pyx_state[33]; __pyx_result.rows = __pyx_state[34]; __pyx_result.rtol_det = __pyx_state[35]; __pyx_result.rtol_lyapunov = __pyx_state[36]; __pyx_result.steps = __pyx_state[37]; __pyx_result.testRate = __pyx_state[38]; __pyx_result.vec_size = __pyx_state[39]
 *     if len(__pyx_state) > 40 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_11__pyx_unpickle_Spp, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Spp, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SppQ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_13__pyx_unpickle_SppQ, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SppQ, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_SppQ__set_state(<SppQ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_SppQ__set_state(SppQ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.B = __pyx_state[0]; __pyx_result.B_vec = __pyx_state[1]; __pyx_result.CM = __pyx_state[2]; __pyx_result.J = __pyx_state[3]; __pyx_result.J_mat = __pyx_state[4]; __pyx_result.M = __pyx_state[5]; __pyx_result.Omega = __pyx_state[6]; __pyx_result.U = __pyx_state[7]; __pyx_result._interp = __pyx_state[8]; __pyx_result._xm = __pyx_state[9]; __pyx_result.alpha = __pyx_state[10]; __pyx_result.beta = __pyx_state[11]; __pyx_result.class_index_dict = __pyx_state[12]; __pyx_result.cols = __pyx_state[13]; __pyx_result.constant_terms = __pyx_state[14]; __pyx_result.contactMatrix = __pyx_state[15]; __pyx_result.det_method = __pyx_state[16]; __pyx_result.det_model = __pyx_state[17]; __pyx_result.dim = __pyx_state[18]; __pyx_result.dsigmadt = __pyx_state[19]; __pyx_result.fi = __pyx_state[20]; __pyx_result.finres_pop = __pyx_state[21]; __pyx_result.finres_terms = __pyx_state[22]; __pyx_result.flat_indices = __pyx_state[23]; __pyx_result.flat_indices1 = __pyx_state[24]; __pyx_result.flat_indices2 = __pyx_state[25]; __pyx_result.fsa = __pyx_state[26]; __pyx_result.full_model_spec = __pyx_state[27]; __pyx_result.gIa = __pyx_state[28]; __pyx_result.gIs = __pyx_state[29]; __pyx_result.infection_terms = __pyx_state[30]; __pyx_result.input_param_mapping = __pyx_state[31]; __pyx_result.input_time_dep_param_mapping = __pyx_state[32]; __pyx_result.linear_terms = __pyx_state[33]; __pyx_result.lyapunov_method = __pyx_state[34]; __pyx_result.model_param_keys = __pyx_state[35]; __pyx_result.model_parameters = __pyx_state[36]; __pyx_result.model_parameters_length = __pyx_state[37]; __pyx_result.model_spec = __pyx_state[38]; __pyx_result.nClass = __pyx_state[39]; __pyx_result.param_dict = __pyx_state[40]; __pyx_result.param_keys = __pyx_state[41]; __pyx_result.param_mapping_enabled = __pyx_state[42]; __pyx_result.parameter_mapping = __pyx_state[43]; __pyx_result.resource_list = __pyx_state[44]; __pyx_result.rows = __pyx_state[45]; __pyx_result.rtol_det = __pyx_state[46]; __pyx_result.rtol_lyapunov = __pyx_state[47]; __pyx_result.steps = __pyx_state[48]; __pyx_result.testRate = __pyx_state[49]; __pyx_result.time_dep_param_mapping = __pyx_state[50]; __pyx_result.vec_size = __pyx_state[51]
 *     if len(__pyx_state) > 52 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_15__pyx_unpickle_SppQ_old, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SppQ_old, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_SppSparse(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pyross_9inference_17__pyx_unpickle_SppSparse, NULL, __pyx_n_s_pyross_inference); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SppSparse, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pyross/inference.pyx":1
 * from itertools import compress             # <<<<<<<<<<<<<<
 * from scipy import sparse
 * from scipy.integrate import solve_ivp, quad
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_u_SIR_type_infer_line_304, __pyx_kp_u_Compute_the_maximum_a_posterior) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_u_SIR_type_infer_mcmc_line_649, __pyx_kp_u_Sample_the_posterior_distributi) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_u_SIR_type_robustness_line_1216, __pyx_kp_u_Robustness_analysis_in_a_two_di) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_u_SIR_type_latent_infer_line_1712, __pyx_kp_u_Compute_the_maximum_a_posterior_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_u_SIR_type_latent_infer_mcmc_line, __pyx_kp_u_Sample_the_posterior_distributi_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "View.MemoryView":209
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
 */
  __pyx_t_7 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_7) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  PyType_Modified(__pyx_array_type);

  /* "View.MemoryView":286
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "View.MemoryView":287
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__95, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "View.MemoryView":288
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "View.MemoryView":291
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "View.MemoryView":292
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__98, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "View.MemoryView":316
 * 
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
 */
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":317
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
 */
  __pyx_t_8[0] = PyThread_allocate_lock();
  __pyx_t_8[1] = PyThread_allocate_lock();
  __pyx_t_8[2] = PyThread_allocate_lock();
  __pyx_t_8[3] = PyThread_allocate_lock();
  __pyx_t_8[4] = PyThread_allocate_lock();
  __pyx_t_8[5] = PyThread_allocate_lock();
  __pyx_t_8[6] = PyThread_allocate_lock();
  __pyx_t_8[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":545
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_7) < 0) __PYX_ERR(1, 545, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  PyType_Modified(__pyx_memoryview_type);

  /* "View.MemoryView":991
 *         return self.from_object
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_7) < 0) __PYX_ERR(1, 991, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  PyType_Modified(__pyx_memoryviewslice_type);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init pyross.inference", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pyross.inference");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* MergeKeywords */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
    PyObject *iter, *key = NULL, *value = NULL;
    int source_is_dict, result;
    Py_ssize_t orig_length, ppos = 0;
    iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
    if (unlikely(!iter)) {
        PyObject *args;
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        args = PyTuple_Pack(1, source_mapping);
        if (likely(args)) {
            PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
            Py_DECREF(args);
            if (likely(fallback)) {
                iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
                Py_DECREF(fallback);
            }
        }
        if (unlikely(!iter)) goto bad;
    }
    while (1) {
        result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
        if (unlikely(result < 0)) goto bad;
        if (!result) break;
        if (unlikely(PyDict_Contains(kwdict, key))) {
            __Pyx_RaiseDoubleKeywordsError("function", key);
            result = -1;
        } else {
            result = PyDict_SetItem(kwdict, key, value);
        }
        Py_DECREF(key);
        Py_DECREF(value);
        if (unlikely(result < 0)) goto bad;
    }
    Py_XDECREF(iter);
    return 0;
bad:
    Py_XDECREF(iter);
    return -1;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* MemviewSliceInit */
static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                        int ndim,
                        __Pyx_memviewslice *memviewslice,
                        int memview_is_new_reference)
{
    __Pyx_RefNannyDeclarations
    int i, retval=-1;
    Py_buffer *buf = &memview->view;
    __Pyx_RefNannySetupContext("init_memviewslice", 0);
    if (memviewslice->memview || memviewslice->data) {
        PyErr_SetString(PyExc_ValueError,
            "memviewslice is already initialized!");
        goto fail;
    }
    if (buf->strides) {
        for (i = 0; i < ndim; i++) {
            memviewslice->strides[i] = buf->strides[i];
        }
    } else {
        Py_ssize_t stride = buf->itemsize;
        for (i = ndim - 1; i >= 0; i--) {
            memviewslice->strides[i] = stride;
            stride *= buf->shape[i];
        }
    }
    for (i = 0; i < ndim; i++) {
        memviewslice->shape[i]   = buf->shape[i];
        if (buf->suboffsets) {
            memviewslice->suboffsets[i] = buf->suboffsets[i];
        } else {
            memviewslice->suboffsets[i] = -1;
        }
    }
    memviewslice->memview = memview;
    memviewslice->data = (char *)buf->buf;
    if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
        Py_INCREF(memview);
    }
    retval = 0;
    goto no_fail;
fail:
    memviewslice->memview = 0;
    memviewslice->data = 0;
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}
#ifndef Py_NO_RETURN
#define Py_NO_RETURN
#endif
static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
    va_list vargs;
    char msg[200];
#ifdef HAVE_STDARG_PROTOTYPES
    va_start(vargs, fmt);
#else
    va_start(vargs);
#endif
    vsnprintf(msg, 200, fmt, vargs);
    va_end(vargs);
    Py_FatalError(msg);
}
static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)++;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)--;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
{
    int first_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (!memview || (PyObject *) memview == Py_None)
        return;
    if (__pyx_get_slice_count(memview) < 0)
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    first_time = __pyx_add_acquisition_count(memview) == 0;
    if (first_time) {
        if (have_gil) {
            Py_INCREF((PyObject *) memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_INCREF((PyObject *) memview);
            PyGILState_Release(_gilstate);
        }
    }
}
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
                                             int have_gil, int lineno) {
    int last_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (!memview ) {
        return;
    } else if ((PyObject *) memview == Py_None) {
        memslice->memview = NULL;
        return;
    }
    if (__pyx_get_slice_count(memview) <= 0)
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    last_time = __pyx_sub_acquisition_count(memview) == 1;
    memslice->data = NULL;
    if (last_time) {
        if (have_gil) {
            Py_CLEAR(memslice->memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_CLEAR(memslice->memview);
            PyGILState_Release(_gilstate);
        }
    } else {
        memslice->memview = NULL;
    }
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
            if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
                return PyFloat_FromDouble((double)a / (double)b);
            }
            return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            }
        }
                __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
                if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                        || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
                    return PyFloat_FromDouble((double)a / (double)b);
                }
                return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            return PyLong_FromLong(x);
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            if (unlikely(zerodivision_check && b == 0)) {
                PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");
                return NULL;
            }
            PyFPE_START_PROTECT("divide", return NULL)
            result = ((double)a) / (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#endif

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(operand) if (unlikely(zerodivision_check && ((operand) == 0))) {\
    PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");\
    return NULL;\
}
static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(0) break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
        }
    } else {
        return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
    }
        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyObjectCallMethod1 */
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
  static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* SliceObject */
  static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* None */
  static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* FetchCommonType */
  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
  #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* py_abs */
  #if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            Py_SIZE(copy) = -(Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* MatrixMultiply */
  #if PY_VERSION_HEX < 0x03050000
static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg) {
    PyObject *result = NULL;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
done:
    Py_DECREF(method);
    return result;
}
#define __Pyx_TryMatrixMethod(x, y, py_method_name) {\
    PyObject *func = __Pyx_PyObject_GetAttrStr(x, py_method_name);\
    if (func) {\
        PyObject *result = __Pyx_PyObject_CallMatrixMethod(func, y);\
        if (result != Py_NotImplemented)\
            return result;\
        Py_DECREF(result);\
    } else {\
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))\
            return NULL;\
        PyErr_Clear();\
    }\
}
static PyObject* __Pyx__PyNumber_MatrixMultiply(PyObject* x, PyObject* y, const char* op_name) {
    int right_is_subtype = PyObject_IsSubclass((PyObject*)Py_TYPE(y), (PyObject*)Py_TYPE(x));
    if (unlikely(right_is_subtype == -1))
        return NULL;
    if (right_is_subtype) {
        __Pyx_TryMatrixMethod(y, x, __pyx_n_s_rmatmul)
    }
    __Pyx_TryMatrixMethod(x, y, __pyx_n_s_matmul)
    if (!right_is_subtype) {
        __Pyx_TryMatrixMethod(y, x, __pyx_n_s_rmatmul)
    }
    PyErr_Format(PyExc_TypeError,
                 "unsupported operand type(s) for %.2s: '%.100s' and '%.100s'",
                 op_name,
                 Py_TYPE(x)->tp_name,
                 Py_TYPE(y)->tp_name);
    return NULL;
}
static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y) {
    __Pyx_TryMatrixMethod(x, y, __pyx_n_s_imatmul)
    return __Pyx__PyNumber_MatrixMultiply(x, y, "@=");
}
#undef __Pyx_TryMatrixMethod
#endif

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* ArgTypeTest */
  static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* WriteUnraisableException */
  static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* SetItemInt */
  static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
#else
    if (is_list || PySequence_Check(o))
#endif
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* IsLittleEndian */
  static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck */
  static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t <= '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
        CYTHON_FALLTHROUGH;
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
        CYTHON_FALLTHROUGH;
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* BufferGetAndValidate */
    static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (unlikely(info->buf == NULL)) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static int __Pyx__GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  buf->buf = NULL;
  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
    __Pyx_ZeroBuffer(buf);
    return -1;
  }
  if (unlikely(buf->ndim != nd)) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if (unlikely((size_t)buf->itemsize != dtype->size)) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_SafeReleaseBuffer(buf);
  return -1;
}

/* BufferFallbackError */
    static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_SetString(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

/* BytesEquals */
    static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
    static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* SliceObject */
    static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_ass_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object does not support slice %.10s",
        Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
bad:
    return -1;
}

/* None */
    static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* PyErrExceptionMatches */
    #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetAttr */
    static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
    static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* pyfrozenset_new */
    static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if (likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
    static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* GetTopmostException */
    #if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* GetException */
    #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* UnpackUnboundCMethod */
    static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
    static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
    static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* Import */
    static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
    static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* HasAttr */
    static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* None */
    static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* decode_c_string */
    static CYTHON_INLINE PyObject* __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)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* SwapException */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* FastTypeChecks */
    #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* None */
    static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* PyObject_GenericGetAttrNoDict */
    #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
    #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
    static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* SetupReduce */
    static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* TypeImport */
    #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
    static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* CLineInTraceback */
    #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
    static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
    #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
        else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


    /* MemviewSliceIsContig */
    static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
{
    int i, index, step, start;
    Py_ssize_t itemsize = mvs.memview->view.itemsize;
    if (order == 'F') {
        step = 1;
        start = 0;
    } else {
        step = -1;
        start = ndim - 1;
    }
    for (i = 0; i < ndim; i++) {
        index = start + step * i;
        if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
            return 0;
        itemsize *= mvs.shape[index];
    }
    return 1;
}

/* OverlappingSlices */
    static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                               void **out_start, void **out_end,
                               int ndim, size_t itemsize)
{
    char *start, *end;
    int i;
    start = end = slice->data;
    for (i = 0; i < ndim; i++) {
        Py_ssize_t stride = slice->strides[i];
        Py_ssize_t extent = slice->shape[i];
        if (extent == 0) {
            *out_start = *out_end = start;
            return;
        } else {
            if (stride > 0)
                end += stride * (extent - 1);
            else
                start += stride * (extent - 1);
        }
    }
    *out_start = start;
    *out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
                     __Pyx_memviewslice *slice2,
                     int ndim, size_t itemsize)
{
    void *start1, *end1, *start2, *end2;
    __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
    __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
    return (start1 < end2) && (start2 < end1);
}

/* Capsule */
    static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
{
    PyObject *cobj;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, NULL);
#else
    cobj = PyCObject_FromVoidPtr(p, NULL);
#endif
    return cobj;
}

/* TypeInfoCompare */
    static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
{
    int i;
    if (!a || !b)
        return 0;
    if (a == b)
        return 1;
    if (a->size != b->size || a->typegroup != b->typegroup ||
            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
        if (a->typegroup == 'H' || b->typegroup == 'H') {
            return a->size == b->size;
        } else {
            return 0;
        }
    }
    if (a->ndim) {
        for (i = 0; i < a->ndim; i++)
            if (a->arraysize[i] != b->arraysize[i])
                return 0;
    }
    if (a->typegroup == 'S') {
        if (a->flags != b->flags)
            return 0;
        if (a->fields || b->fields) {
            if (!(a->fields && b->fields))
                return 0;
            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                __Pyx_StructField *field_a = a->fields + i;
                __Pyx_StructField *field_b = b->fields + i;
                if (field_a->offset != field_b->offset ||
                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                    return 0;
            }
            return !a->fields[i].type && !b->fields[i].type;
        }
    }
    return 1;
}

/* MemviewSliceValidateAndInit */
    static int
__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
{
    if (buf->shape[dim] <= 1)
        return 1;
    if (buf->strides) {
        if (spec & __Pyx_MEMVIEW_CONTIG) {
            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                if (buf->strides[dim] != sizeof(void *)) {
                    PyErr_Format(PyExc_ValueError,
                                 "Buffer is not indirectly contiguous "
                                 "in dimension %d.", dim);
                    goto fail;
                }
            } else if (buf->strides[dim] != buf->itemsize) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
        if (spec & __Pyx_MEMVIEW_FOLLOW) {
            Py_ssize_t stride = buf->strides[dim];
            if (stride < 0)
                stride = -stride;
            if (stride < buf->itemsize) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
    } else {
        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not contiguous in "
                         "dimension %d", dim);
            goto fail;
        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not indirect in "
                         "dimension %d", dim);
            goto fail;
        } else if (buf->suboffsets) {
            PyErr_SetString(PyExc_ValueError,
                            "Buffer exposes suboffsets but no strides");
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
{
    if (spec & __Pyx_MEMVIEW_DIRECT) {
        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer not compatible with direct access "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    if (spec & __Pyx_MEMVIEW_PTR) {
        if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer is not indirectly accessible "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
{
    int i;
    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = 0; i < ndim; i++) {
            if (stride * buf->itemsize != buf->strides[i] &&
                    buf->shape[i] > 1)
            {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not fortran contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = ndim - 1; i >- 1; i--) {
            if (stride * buf->itemsize != buf->strides[i] &&
                    buf->shape[i] > 1) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not C contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    }
    return 1;
fail:
    return 0;
}
static int __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)
{
    struct __pyx_memoryview_obj *memview, *new_memview;
    __Pyx_RefNannyDeclarations
    Py_buffer *buf;
    int i, spec = 0, retval = -1;
    __Pyx_BufFmt_Context ctx;
    int from_memoryview = __pyx_memoryview_check(original_obj);
    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                            original_obj)->typeinfo)) {
        memview = (struct __pyx_memoryview_obj *) original_obj;
        new_memview = NULL;
    } else {
        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                            original_obj, buf_flags, 0, dtype);
        new_memview = memview;
        if (unlikely(!memview))
            goto fail;
    }
    buf = &memview->view;
    if (buf->ndim != ndim) {
        PyErr_Format(PyExc_ValueError,
                "Buffer has wrong number of dimensions (expected %d, got %d)",
                ndim, buf->ndim);
        goto fail;
    }
    if (new_memview) {
        __Pyx_BufFmt_Init(&ctx, stack, dtype);
        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
    }
    if ((unsigned) buf->itemsize != dtype->size) {
        PyErr_Format(PyExc_ValueError,
                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                     buf->itemsize,
                     (buf->itemsize > 1) ? "s" : "",
                     dtype->name,
                     dtype->size,
                     (dtype->size > 1) ? "s" : "");
        goto fail;
    }
    for (i = 0; i < ndim; i++) {
        spec = axes_specs[i];
        if (!__pyx_check_strides(buf, i, ndim, spec))
            goto fail;
        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
            goto fail;
    }
    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                         new_memview != NULL) == -1)) {
        goto fail;
    }
    retval = 0;
    goto no_fail;
fail:
    Py_XDECREF(new_memview);
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}

/* ObjectToMemviewSlice */
    static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 1,
                                                 &__Pyx_TypeInfo_double, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* CIntFromPyVerify */
    #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
    static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
    return (PyObject *) PyFloat_FromDouble(*(double *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) {
    double value = __pyx_PyFloat_AsDouble(obj);
    if ((value == (double)-1) && PyErr_Occurred())
        return 0;
    *(double *) itemp = value;
    return 1;
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
    const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Py_intptr_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Py_intptr_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
    static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp) {
    return (PyObject *) __Pyx_PyInt_From_int(*(int *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) {
    int value = __Pyx_PyInt_As_int(obj);
    if ((value == (int)-1) && PyErr_Occurred())
        return 0;
    *(int *) itemp = value;
    return 1;
}

/* Declarations */
    #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
    #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = (float)(1.0) / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = (float)(1.0) / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
    #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
    #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = (double)(1.0) / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = (double)(1.0) / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

/* CIntToPy */
    static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
    const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum NPY_TYPES) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
                                     little, !is_unsigned);
    }
}

/* MemviewSliceCopyTemplate */
    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)
{
    __Pyx_RefNannyDeclarations
    int i;
    __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
    struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
    Py_buffer *buf = &from_memview->view;
    PyObject *shape_tuple = NULL;
    PyObject *temp_int = NULL;
    struct __pyx_array_obj *array_obj = NULL;
    struct __pyx_memoryview_obj *memview_obj = NULL;
    __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
    for (i = 0; i < ndim; i++) {
        if (from_mvs->suboffsets[i] >= 0) {
            PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                           "indirect dimensions (axis %d)", i);
            goto fail;
        }
    }
    shape_tuple = PyTuple_New(ndim);
    if (unlikely(!shape_tuple)) {
        goto fail;
    }
    __Pyx_GOTREF(shape_tuple);
    for(i = 0; i < ndim; i++) {
        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
        if(unlikely(!temp_int)) {
            goto fail;
        } else {
            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
            temp_int = NULL;
        }
    }
    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
    if (unlikely(!array_obj)) {
        goto fail;
    }
    __Pyx_GOTREF(array_obj);
    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                    (PyObject *) array_obj, contig_flag,
                                    dtype_is_object,
                                    from_mvs->memview->typeinfo);
    if (unlikely(!memview_obj))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
        goto fail;
    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                dtype_is_object) < 0))
        goto fail;
    goto no_fail;
fail:
    __Pyx_XDECREF(new_mvs.memview);
    new_mvs.memview = NULL;
    new_mvs.data = NULL;
no_fail:
    __Pyx_XDECREF(shape_tuple);
    __Pyx_XDECREF(temp_int);
    __Pyx_XDECREF(array_obj);
    __Pyx_RefNannyFinishContext();
    return new_mvs;
}

/* CIntFromPy */
    static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
    static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
    static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
    const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* ObjectToMemviewSlice */
    static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 2,
                                                 &__Pyx_TypeInfo_double, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
    static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 4,
                                                 &__Pyx_TypeInfo_double, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
    static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 2,
                                                 &__Pyx_TypeInfo_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
    static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS_RO | writable_flag, 1,
                                                 &__Pyx_TypeInfo_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* CStringEquals */
    static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    return *s1 == *s2;
}

/* CheckBinaryVersion */
    static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
    static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
